-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(selection-list): incorrect cursor if disabled #9963
fix(selection-list): incorrect cursor if disabled #9963
Conversation
src/lib/list/selection-list.ts
Outdated
'[class.mat-list-item-disabled]': 'disabled', | ||
'[class.mat-list-item-focus]': '_hasFocus', | ||
'[attr.aria-selected]': 'selected.toString()', | ||
'[attr.aria-disabled]': 'disabled.toString()', | ||
'[attr.tabindex]': 'disabled ? null : -1' |
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'm not sure whether it should be completely un-focusable when it's disabled. If that's the case, users might not know that the list is even there. There are some examples in the a11y guidelines where items are still focusable when disabled, but they don't do anything when clicked. E.g. here's an excerpt from the menu guidelines:
Disabled menu items are focusable but cannot be activated.
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.
That's a good point. How about keeping it focusable? but just ignoring keypress events?
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.
Just thought a bit more about it. Even if the disabled list is focusable, the user wouldn't be able to walk through the individual options, and therefore it wouldn't really help knowing that there is a list?
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.
True, but the question is whether the user shouldn't be able to tab through the list items, even if they're disabled.
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 see what you mean. I think allowing to tab through the list items makes sense. We would just disable the toggling behavior.
Also if we do this, then we'd need to find a way for the ListKeyManager
that still allows the user to navigate to disabled items. e.g. a new option for the list key manager. Thoughts?
* Currently if the `ListKeyManager` is being used in wrap mode, and all items are disabled, pressing the down arrow key will cause the key manager to go into an infinite loop that searches for the next item. Related angular#9963
* Currently if the `ListKeyManager` is being used in wrap mode, and all items are disabled, pressing the down arrow key will cause the key manager to go into an infinite loop that searches for the next item. Related angular#9963
* Currently if a list option is disabled through the `[disabled]` binding, the disabled option still has the `pointer` cursor. * No longer delegates the keydown event to the ListKeyManager when disabled. Right now there can be an exception because all items are disabled. See angular#9981. Fixes angular#9952.
8c9ce52
to
196f4c4
Compare
@crisbeto I decided to not touch the Also to avoid any runtime exceptions in combination with #9981 I added a security check to the |
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.
LGTM
Currently if the `ListKeyManager` is being used in wrap mode, and all items are disabled, pressing the down arrow key will cause the key manager to go into an infinite loop that searches for the next item. Related #9963
Currently if the `ListKeyManager` is being used in wrap mode, and all items are disabled, pressing the down arrow key will cause the key manager to go into an infinite loop that searches for the next item. Related #9963
Currently if the `ListKeyManager` is being used in wrap mode, and all items are disabled, pressing the down arrow key will cause the key manager to go into an infinite loop that searches for the next item. Related #9963
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
[disabled]
binding, the disabled option still has thepointer
cursor.Fixes #9952