-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Accessibility] Refactor font slider for accessibility #14817
Conversation
Jenkins, test this |
in the text boxes the second value can be smaller than the first one, which isn't possible to do with slider ... should we block that ? |
Changed that behavior: the absolute min/max is still enforced by the browser and the |
ehm ... this gives quite a weird experience ...
probably the check should only happen after leaving the box (or on pressing enter) |
Oh shit, yeah that's true. So we basically have two options here I think about: a) we change the ng-model-options to only apply the value to scope when bluring the input field. That way the slider wouldn't change immediately when updating the values in the text field (e.g. also by pressing up/down), but therefore we wouldn't have to bother with that above issue. Any other options you see, that would be a good solution? |
c) allow submitting crossing ranges, but turn them around on submit ? (so 50 - 5 turns into 5 - 50) none of the options seem perfect ... |
I think option A is my expected behavior. If I enter invalid input it will show up in the input fields with an error state and an error message, but the invalid input won't be reflected in the slider and won't be saved if I try to save the visualization. |
can we use this PR to address #11406 as well? |
@thomasneirynck I would rather have a look at #14565 which is most likely the cause of that issue. I thought I checked it against |
This reverts commit 575dfac.
@cjcenizal The behavior you are describing would actually be more option b not a :-) Option B would also align with other suggestions, so I basically reverted the change to use option B again, and we should consider this again when building our own ranged slider. So would welcome some reviews :-) |
#9168 will be a separate effort. For now, this will solve the immediate pain points of this 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.
@@ -11,6 +11,32 @@ | |||
<div class="form-group"> | |||
<label>Font Size</label> | |||
<div class="tag-cloud-fontsize-slider"></div> | |||
<div class="tag-cloud-fontsize-inputs"> |
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.
You can replace this class with kuiBar
.
@@ -11,6 +11,32 @@ | |||
<div class="form-group"> | |||
<label>Font Size</label> | |||
<div class="tag-cloud-fontsize-slider"></div> | |||
<div class="tag-cloud-fontsize-inputs"> | |||
<div class="tag-cloud-fontsize-input"> |
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.
And then you can replace this class and the one on line 27 with kuiBarSection
. Then you'll be able to delete these styles from tag_cloud.less
.
type="number" | ||
min="1" | ||
max="{{vis.params.maxFontSize}}" | ||
class="form-control tag-cloud-fontsize-inputfield" |
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.
I think we can replace these classes with kuiTextInput kuiTextInput--small
.
aria-label="Maximum tag font size" | ||
aria-describedby="tagCloudFontSliderMaxUnit" | ||
> | ||
<span id="tagCloudFontSliderMaxUnit">px</span> |
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.
Screen readers read this as "P, X". Should we add aria-label="pixels"
to make it clearer?
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.
Looks good.
One minor suggestion, not deal breaker:
Typing in an invalid value shows a red outline. Works good, but then perhaps we should disable the play-button and show some feedback in the little error-icon next to it, similar to other places in visualize?
Another approach, but maybe we can auto-justify the input to 1 and 100, and auto-update any value that exceeds this.
@cjcenizal I updated the PR for another review. I just didn't use the |
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.
@timroes LGTM! Re the input, we can change the kuiTextInput--small
size in the UI Framework itself, so that it fits "100" as an input. I think you've exposed a flaw with that component which we can/should fix but it's not a big deal.
* Refactor font slider for accessibility, fix elastic#12905 * Limit input fields min/max values * Prevent crossing of min/max values * Revert "Prevent crossing of min/max values" This reverts commit 575dfac. * Use UI framework classes
This PR changes the font slider in the tag cloud editor a bit, by replacing it's non accessible popovers via two number input fields below it:
When using the slider the values in the input fields will be changed immediately, and you can use the input fields vise versa to change the font, and the slider will automatically update.
This version now is fully accessible and should work well until we build a custom range picker in our UI framework.
Fixes #12905