RESOLVED FIXED 243768
AX: role="spinbutton" elements are not adjustable on iOS
https://bugs.webkit.org/show_bug.cgi?id=243768
Summary AX: role="spinbutton" elements are not adjustable on iOS
Tyler Wilcock
Reported 2022-08-09 22:03:18 PDT
role="spinbutton" components are not required to have accompanying buttons to adjust the value, so they should be adjustable on their own. Example component can be found on: https://www.w3.org/WAI/ARIA/apg/patterns/spinbutton/
Attachments
Patch (12.44 KB, patch)
2022-08-09 22:07 PDT, Tyler Wilcock
no flags
Patch (14.11 KB, patch)
2022-08-09 22:21 PDT, Tyler Wilcock
no flags
Patch (16.17 KB, patch)
2022-08-10 10:51 PDT, Tyler Wilcock
no flags
Patch (16.16 KB, patch)
2022-08-10 16:45 PDT, Tyler Wilcock
no flags
Patch (16.35 KB, patch)
2022-08-11 22:07 PDT, Tyler Wilcock
no flags
Radar WebKit Bug Importer
Comment 1 2022-08-09 22:03:28 PDT
Tyler Wilcock
Comment 2 2022-08-09 22:07:48 PDT
Tyler Wilcock
Comment 3 2022-08-09 22:21:37 PDT
Andres Gonzalez
Comment 4 2022-08-10 05:50:18 PDT
(In reply to Tyler Wilcock from comment #3) > Created attachment 461520 [details] > Patch Looks good. --- a/LayoutTests/accessibility/spinbutton-increment-decrement.html +++ a/LayoutTests/accessibility/spinbutton-increment-decrement.html Should we also test that the spin button exposes the right value after increment/decrement?
Tyler Wilcock
Comment 5 2022-08-10 10:51:00 PDT
James Craig
Comment 6 2022-08-10 14:57:09 PDT
Comment on attachment 461531 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=461531&action=review > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1205 > +void AccessibilityNodeObject::alterStepperValue(StepAction stepAction) How about "range" which the superclass of slider, scrollbar, and spinbutton. Note: ARIA spinbutton = Mac "stepper" > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1207 > + if (roleValue() != AccessibilityRole::Slider && roleValue() != AccessibilityRole::SpinButton) scrollbar too, right? > Source/WebCore/accessibility/AccessibilityNodeObject.cpp:1217 > if (!getAttribute(stepAttr).isEmpty()) > - changeValueByStep(increase); > + changeValueByStep(stepAction); > else > - changeValueByPercent(increase ? 5 : -5); > + changeValueByPercent(stepAction == StepAction::Increment ? 5 : -5); I think direct value changes should only happen on native form elements, never on custom ARIA fields. Does this cover all the HTML5 stepper types like <input type="number">? There are about 2 dozen input types, and several are steppers. The layout test should probably cover these too... I don't recall if the stepAttr conditional will catch all. Does this also catch the default step value when the attribute is missing like `input[type=slider]:not([step])`?
James Craig
Comment 7 2022-08-10 15:08:13 PDT
> several are steppers. Looks likeWebKit, Chrome, and Firefox implement type=number as the only stepper, too. I recalled there were more. 🤷
Tyler Wilcock
Comment 8 2022-08-10 16:45:04 PDT
Andres Gonzalez
Comment 9 2022-08-11 05:16:38 PDT
(In reply to Tyler Wilcock from comment #8) > Created attachment 461539 [details] > Patch --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp +++ a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp void AccessibilityNodeObject::changeValueByPercent(float percentChange) @@ -1321,7 +1325,7 @@ void AccessibilityNodeObject::changeValueByPercent(float percentChange) step = std::abs(percentChange) * (1 / percentChange); value += step; - setNodeValue(percentChange > 0, value); + setNodeValue(percentChange > 0 ? StepAction::Increment : StepAction::Decrement, value); } This function is missing some early returns and sanity checks like percentCahnge == 0, and value between min and max... Since you're touching this, could you please add them? --- a/LayoutTests/platform/ios/accessibility/spinbutton-increment-decrement-expected.txt +++ a/LayoutTests/platform/ios/accessibility/spinbutton-increment-decrement-expected.txt Interesting that the value for MacOS and iOS differ in type? int vs float?
Tyler Wilcock
Comment 10 2022-08-11 22:07:56 PDT
Tyler Wilcock
Comment 11 2022-08-11 22:14:41 PDT
(In reply to Andres Gonzalez from comment #9) > (In reply to Tyler Wilcock from comment #8) > > Created attachment 461539 [details] > > Patch > > --- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp > +++ a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp > > void AccessibilityNodeObject::changeValueByPercent(float percentChange) > @@ -1321,7 +1325,7 @@ void > AccessibilityNodeObject::changeValueByPercent(float percentChange) > step = std::abs(percentChange) * (1 / percentChange); > > value += step; > - setNodeValue(percentChange > 0, value); > + setNodeValue(percentChange > 0 ? StepAction::Increment : > StepAction::Decrement, value); > } > > This function is missing some early returns and sanity checks like > percentCahnge == 0, and value between min and max... Since you're touching > this, could you please add them? I added the check for !percentChange. Investigated the prevention of setting values outside the min and max, but that will be a little more involved (because we can't just do it in this one function, or need to centralize it somewhere else) and will require it's own layout test, so I think it will be best to save that one for a separate patch. > --- > a/LayoutTests/platform/ios/accessibility/spinbutton-increment-decrement- > expected.txt > +++ > a/LayoutTests/platform/ios/accessibility/spinbutton-increment-decrement- > expected.txt > Interesting that the value for MacOS and iOS differ in type? int vs float? Yeah, it's unfortunate...we should make these the same in a later patch.
EWS
Comment 12 2022-08-13 10:29:18 PDT
Committed 253403@main (9a87db7810f8): <https://commits.webkit.org/253403@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 461555 [details].
Note You need to log in before you can comment on or make changes to this bug.