fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

In SpinButton control there is no relation between the increment/decrement buttons with the SpinButton

Open petewu100 opened this issue 4 years ago • 5 comments

On the FluentUI SpinButton test page, https://developer.microsoft.com/en-us/fluentui#/controls/web/spinbutton, open the browser Dev Tools and inspect the first SpinButton control:

Note: the increment/decrement buttons do not have a relationship with the element. They are not child elements and they are not "owned" by it.

Expected: the increment/decrement buttons to be owned by the element.

The ARIA documentation says you may do this, but don't have to:

Accessible Rich Internet Applications (WAI-ARIA) 1.2 (w3.org)

Authors MAY create a spinbutton with children or owned elements, but MUST limit those elements to a textbox and/or two buttons. Alternatively, authors MAY apply the spinbutton role to a text input and create sibling buttons to support the increment and decrement functions.

For example, we could add aria-owns="incrementbutton-xxx decrementbutton-xxx" to element and id="incrementbutton-xxx" to the increment button and id="decrementbutton-xxx" to the decrement button.

Though, interestingly, the example in the ARIA Authoring Practices doesn't do it:

Date Picker Spin Button Example | WAI-ARIA Authoring Practices 1.1 (w3.org)

Not sure whether any browser handles this and exposes the relationship in the accessibility tree.

petewu100 avatar Jan 26 '22 17:01 petewu100

Here's the HTML (formatted in Markdown):

<input id="input333" class="ms-spinButton-input input-313" type="text" autocomplete="off" role="spinbutton" aria-labelledby="Label334" aria-valuenow="1" aria-valuemin="0" aria-valuemax="100" aria-disabled="false" data-lpignore="true" data-ktp-execute-target="true" value="1" spellcheck="false" data-ms-editor="true">
<span class="arrowButtonsContainer-314">
    <button type="button" class="ms-Button ms-Button--icon ms-UpButton root-316" tabindex="-1" data-is-focusable="false" aria-label="Increase value by 1">
        <span class="ms-Button-flexContainer flexContainer-152" data-automationid="splitbuttonprimary">
            <i data-icon-name="ChevronUpSmall" aria-hidden="true" class="ms-Icon root-89 css-319 ms-Button-icon icon-317" style="font-family: FabricMDL2Icons-2;"></i>
        </span>
    </button>
    <button type="button" class="ms-Button ms-Button--icon ms-DownButton root-316" tabindex="-1" data-is-focusable="false" aria-label="Decrease value by 1">
        <span class="ms-Button-flexContainer flexContainer-152" data-automationid="splitbuttonprimary">
            <i data-icon-name="ChevronDownSmall" aria-hidden="true" class="ms-Icon root-89 css-321 ms-Button-icon icon-317" style="font-family: FabricMDL2Icons-3;"></i>
        </span>
    </button>
</span>

petewu100 avatar Jan 26 '22 17:01 petewu100

In Accessibility Insights for Windows, you can see that in the UI Automation tree, the increment/decrement buttons are sibling elements rather than child elements of the spin button element:

FluentUI SpinButton Edge AccessibilityInsights 8 51 1

petewu100 avatar Jan 26 '22 17:01 petewu100

@petewu100 - Thanks for filing this issue with us. To set expectations, the developers will review this issue once capacity allows as we’re currently focused on larger coherence work items.

@TristanWatanabe - Would you be able to confirm if this is a regression, or if this behavior is an issue? cc @smhigley

gouttierre avatar Feb 03 '22 14:02 gouttierre

@petewu100 could you elaborate on the reason for wanting the increment/decrement buttons to be children of the spinbutton? My instinct is that this would be a much more risky approach, since role="spinbutton", even if on a div, is traditionally an editable control.

In our specific case, we are actually using an <input> element, so I definitely want to steer away from this. Forcing something to be a child of an input just seems like asking for trouble (e.g. the whole ARIA 1.1 combobox thing).

smhigley avatar May 27 '22 20:05 smhigley

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fluent UI!

msft-fluent-ui-bot avatar May 31 '22 23:05 msft-fluent-ui-bot