@@ -21,6 +21,10 @@ const props = defineProps({
2121 type: String ,
2222 default: ' left' ,
2323 },
24+ fromOverflow: {
25+ type: Boolean ,
26+ default: false ,
27+ }
2428});
2529
2630const currentItem = ref (null );
@@ -91,13 +95,24 @@ const dropdownOptions = (item) => {
9195 });
9296};
9397
98+ const getDropdownAttributes = (option , item ) => {
99+ return {
100+ role: ' menuitem' ,
101+ ariaLabel: ` ${ item .attributes .value .ariaLabel } - ${ option .label } ` ,
102+ };
103+ };
104+
94105const handleClickOutside = (e ) => {
95106 closeDropdowns ();
96107};
97108< / script>
98109
99110< template>
100- < div : style= " getPositionStyle" class = " button-group" >
111+ < div
112+ : style= " getPositionStyle"
113+ class = " button-group"
114+ role= " group"
115+ >
101116 < div v- for = " item in toolbarItems" : key= " item.id.value" : class = " {
102117 narrow: item.isNarrow.value,
103118 wide: item.isWide.value,
@@ -106,11 +121,23 @@ const handleClickOutside = (e) => {
106121 < ToolbarSeparator v- if = " isSeparator(item)" style= " width: 20px" / >
107122
108123 <!-- Toolbar button -->
109- < n- dropdown v- if = " isDropdown(item) && item.nestedOptions?.value?.length" : options= " dropdownOptions(item)"
110- : trigger= " item.disabled.value ? null : 'click'" : show= " item.expand.value" size= " medium" placement= " bottom-start"
111- class = " toolbar-button toolbar-dropdown sd-editor-toolbar-dropdown" : class = " { 'high-contrast': isHighContrastMode }"
112- @select= " (key, option) => handleSelect(item, option)" @clickoutside= " handleClickOutside"
113- : style= " item.dropdownStyles.value" >
124+ < n- dropdown
125+ v- if = " isDropdown(item) && item.nestedOptions?.value?.length"
126+ : options= " dropdownOptions(item)"
127+ : trigger= " item.disabled.value ? null : 'click'"
128+ : show= " item.expand.value"
129+ size= " medium"
130+ placement= " bottom-start"
131+ class = " toolbar-button toolbar-dropdown sd-editor-toolbar-dropdown"
132+ : class = " { 'high-contrast': isHighContrastMode }"
133+ @select= " (key, option) => handleSelect(item, option)"
134+ @clickoutside= " handleClickOutside"
135+ : style= " item.dropdownStyles.value"
136+ : menu- props= " () => ({
137+ role: 'menu'
138+ })"
139+ : node- props= " (option) => getDropdownAttributes(option, item)"
140+ >
114141 < n- tooltip trigger= " hover" : disabled= " !item.tooltip?.value" >
115142 < template #trigger>
116143 < ToolbarButton : toolbar- item= " item" @textSubmit= " handleToolbarButtonTextSubmit(item, $event)"
@@ -125,8 +152,12 @@ const handleClickOutside = (e) => {
125152
126153 < n- tooltip trigger= " hover" v- else - if = " isButton(item)" class = " sd-editor-toolbar-tooltip" >
127154 < template #trigger>
128- < ToolbarButton : toolbar- item= " item" @textSubmit= " handleToolbarButtonTextSubmit(item, $event)"
129- @buttonClick= " handleToolbarButtonClick(item)" / >
155+ < ToolbarButton
156+ : toolbar- item= " item"
157+ : is- overflow- item= " fromOverflow"
158+ @textSubmit= " handleToolbarButtonTextSubmit(item, $event)"
159+ @buttonClick= " handleToolbarButtonClick(item)"
160+ / >
130161 < / template>
131162 < div v- if = " item.tooltip" >
132163 {{ item .tooltip }}
0 commit comments