-
Notifications
You must be signed in to change notification settings - Fork 0
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/slider input validation #65
Conversation
Visit the preview URL for this PR (updated for commit 1d21a85): https://test-auth-d13f2--pr65-fix-slider-2-fvnsnvtu.web.app (expires Tue, 13 Sep 2022 08:37:29 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Since Stencil 2.17.2 they have added a mock blur to their event api. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input field is not populated with a value on render, it is only updated on slider change.
Keyboard navigation is difficult/impossible.
- Hitting enter when focused on input field does not set the value
- Entering a number starts with an invalid value forces the user out of focus. To repeat; go to Stepped story, tab into the input field, try to type "15". After entering "1" focus will be removed and the slider will move to 5.
packages/component-library/src/components/plmg-slider/plmg-slider.tsx
Outdated
Show resolved
Hide resolved
packages/component-library/src/components/plmg-slider/plmg-slider.tsx
Outdated
Show resolved
Hide resolved
packages/component-library/src/components/plmg-slider/test/plmg-slider.e2e.ts
Outdated
Show resolved
Hide resolved
Updates
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments for you to check out
Reset | ||
</PlmgButton> | ||
<label>{SLIDERS.stepped.label}</label> | ||
<PlmgSlider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Managed to recreate the bug by putting a fixed width on the slider (240px).
The input field is actually set by the 'size' value, which is specified by the max value of the input number field. Forcing a min-width on the input field changes the input field, causing the input field to change size and making it overflow its container.
Using an outline is also causing an additional overflow.
Fix: removed min-width, added a negative outline-offset on the input field
// Without min-width
The reason I was using min-width was to make the input field match the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'track value' (the input range slider container's) width was getting changed between rendering the component container and calculating the thumb position because of flex gap and fit-content. Changing flex gap for margin-left with a fixed value and removing fit-content prevents input from rendering.
packages/component-library/src/components/plmg-slider/plmg-slider.stories.js
Outdated
Show resolved
Hide resolved
packages/component-library/src/components/plmg-slider/plmg-slider.stories.js
Outdated
Show resolved
Hide resolved
packages/component-library/src/components/plmg-slider/plmg-slider.stories.js
Outdated
Show resolved
Hide resolved
@nathan-bird: I've added a prop to allow the user to control textInputWidth. This is not because of the thumb positioning issue, which I've fixed separately, but I think we need this to control to maintain visual consistency. As discussed in the spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates look ok. Would be nice with a test of the new control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Next time something like this could be many smaller PRs which would make it faster to review and merge.
Closes [BUG] Slider - Number input validation too restrictive
Matches updated UX spec
Changes
Issues