-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Implement the feature that close issuse as archived/merged/resolved #23522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
57cb23d
13a5e3d
1eb8b18
b7ab794
96cca04
9516184
4a9e672
4af0bcd
ba8b08b
71c03a5
baf2ab7
a12c386
7b68c3f
b625d55
2de28aa
1c6365e
d7db875
f1ff475
d0ce23f
42cc712
466fcb3
69d46a9
4c092df
cb2accb
f117aa0
099fd27
04e98a0
3ce31c8
f8b80f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,8 @@ function attachOneDropdownAria($dropdown) { | |
const listPopupRole = isComboBox ? 'listbox' : 'menu'; | ||
const listItemRole = isComboBox ? 'option' : 'menuitem'; | ||
|
||
const needKeepAtive = $dropdown.hasClass('keep-active'); | ||
|
||
// make the item has role=option/menuitem, add an id if there wasn't one yet, make items as non-focusable | ||
// the elements inside the dropdown menu item should not be focusable, the focus should always be on the dropdown primary element. | ||
function prepareMenuItem($item) { | ||
|
@@ -97,8 +99,9 @@ function attachOneDropdownAria($dropdown) { | |
// if the popup is visible and has an active/selected item, use its id as aria-activedescendant | ||
if (menuVisible) { | ||
$focusable.attr('aria-activedescendant', $active.attr('id')); | ||
} else if (!isComboBox) { | ||
// for menu, when the popup is hidden, no need to keep the aria-activedescendant, and clear the active/selected item | ||
} else if (!isComboBox && !needKeepAtive) { | ||
// for menu in most cases, when the popup is hidden, no need to keep the aria-activedescendant, and clear the active/selected item | ||
// if you really need to keep the aria-activedescendant, plz add a className 'keep-active' to the dropdown | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You need to make it a For example: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow, a quick comment~That's exactly what I wanted to ask you. |
||
$focusable.removeAttr('aria-activedescendant'); | ||
$active.removeClass('active').removeClass('selected'); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wxiaoguang hi, in this case, i need to keep

check
icon active even if the menu is hidden and reopened.So, I add a classname 'keep-active' to the dropdown. But I'm not sure that's a good idea. Do you have better one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have commented above 😂