Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(LemonSlider): change type of button in LemonSlider "button" instead of "submit" #29088

Merged
merged 2 commits into from
Feb 21, 2025

Conversation

havenbarnes
Copy link
Contributor

Problem

I noticed that pressing on the button within Sliders submits a form if the slider is in one. I can't imagine we're relying on this behavior anywhere, and it feels buggy.

Changes

Cause of bug: On most browsers, the default button type is submit. This simply overrides the type to button

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Screenity.video.-.Feb.21.2025.mp4

@havenbarnes havenbarnes requested review from adamleithp and a team February 21, 2025 21:56
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Fixed an issue where LemonSlider's handle button could trigger unintended form submissions by defaulting to type="submit" in browsers.

  • Modified /frontend/src/lib/lemon-ui/LemonSlider/LemonSlider.tsx to explicitly set type="button" on the slider handle button
  • Prevents form submission when interacting with sliders placed within forms while maintaining all existing slider functionality

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

github-actions bot commented Feb 21, 2025

Size Change: +14 B (0%)

Total Size: 9.71 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 9.71 MB +14 B (0%)

compressed-size-action

@havenbarnes havenbarnes merged commit ec83a41 into master Feb 21, 2025
97 checks passed
@havenbarnes havenbarnes deleted the fix/flags-rollout-slider-bug branch February 21, 2025 23:46
Copy link
Contributor

@adamleithp adamleithp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely good call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants