Files
tubestation/toolkit/content/widgets
Tim Giles 2a36efa838 Bug 1927205 - Make moz-radio behave as a OS dialog radio button in chrome UI. r=reusable-components-reviewers,hjones
Due to how macOS handles focus for radio buttons in native dialogs,
we needed to change how moz-radio behaves in the chrome UI. In macOS,
clicking a radio button in a native dialog does not activate a focus
ring nor does the click move the focus to that radio button. These
changes allow the moz-radio element to be clicked in the chrome UI
without moving focus.

Due to the requested behavior, we needed to change how moz-radio-group
handled keyboard navigation and how moz-radio handled click events.
Now moz-radio-group behaves as the source of truth for the state of
its child moz-radio elements. This involves calling the relevant
`focus()` method on the appropriate moz-radio element as well as
emitting 'input' and 'change' events on keyboard navigation between
radio buttons.

Since this change specifically changes the macOS behavior, the relevant
tests needed to have specific cases for macOS. This mainly involves
calling `mozRadio.focus()` if the `test_moz_radio_group.html` test
clicks a moz-radio element.

Additionally, due to the moz-radio element no longer handling the
'click' event by clicking its inner HTML input element, the events we
verify in our test had to be updated.

Switch to using synthesizeMouseAtCenter in the
testRadioGroupKeyboardNavigation task since focus will not move to a
moz-radio button on click unless the containing moz-radio-group is the
active element in the document.

Add assertion in the keyboard navigation test to ensure focus moves as
expected if you call .click() on an unselected moz-radio button inside
of the active moz-radio-group.

Differential Revision: https://phabricator.services.mozilla.com/D235384
2025-02-03 22:50:50 +00:00
..