Skip to content

Commit

Permalink
find a default accessibleName for rectangular radio buttons, see #911
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg committed Nov 8, 2024
1 parent 1508a67 commit 3e5364f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/buttons/RectangularRadioButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import InstanceRegistry from '../../../phet-core/js/documentation/InstanceRegist
import optionize, { combineOptions } from '../../../phet-core/js/optionize.js';
import PickOptional from '../../../phet-core/js/types/PickOptional.js';
import StrictOmit from '../../../phet-core/js/types/StrictOmit.js';
import { Color, FlowBox, FlowBoxOptions, HighlightFromNode, Node, ParallelDOM, ParallelDOMOptions, PDOMPeer, SceneryConstants, TInputListener, TrimParallelDOMOptions } from '../../../scenery/js/imports.js';
import { Color, FlowBox, FlowBoxOptions, HighlightFromNode, Node, ParallelDOM, ParallelDOMOptions, PDOMPeer, PDOMUtils, SceneryConstants, TInputListener, TrimParallelDOMOptions } from '../../../scenery/js/imports.js';
import multiSelectionSoundPlayerFactory from '../../../tambo/js/multiSelectionSoundPlayerFactory.js';
import TSoundPlayer from '../../../tambo/js/TSoundPlayer.js';
import Tandem from '../../../tandem/js/Tandem.js';
Expand Down Expand Up @@ -244,6 +244,13 @@ export default class RectangularRadioButtonGroup<T> extends FlowBox {
}
buttons.push( button );

// pdom - If the radio button was not assigned an accessibleName, search for a default one
// in the button. It may come from the button content or its label.
if ( !radioButton.accessibleName ) {
radioButton.accessibleName = PDOMUtils.findStringProperty( button );
console.log( radioButton.accessibleName );
}

// The highlight for the radio button should surround the layout Node if one is used.
const focusHighlight = new HighlightFromNode( button );
buttonsWithLayoutNodes.push( { radioButton: radioButton, layoutNode: button, focusHighlight: focusHighlight } );
Expand Down

0 comments on commit 3e5364f

Please sign in to comment.