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

Element Click allows <option disabled> to be selected #1187

Closed
andreastt opened this Issue Jan 9, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@andreastt
Member

andreastt commented Jan 9, 2018

It was reported to us in mozilla/geckodriver#1107 that the Element Click command lets you select <option disabled>.

It’s not clear to me what the expected behaviour is. Since we don’t check disabled/readonly for any other elements when clicking, I’m guessing WebDriver should return silently and not change the element’s selectedness?

@barancev

This comment has been minimized.

Show comment
Hide comment
@barancev

barancev Jan 9, 2018

A user can't select a disabled option, neither with the mouse nor with the keyboard. So I suppose Selenium should not be able to select it too. Yes, a user can click a disabled option, but this action does not change the selected element, it's effectively a no-op.

barancev commented Jan 9, 2018

A user can't select a disabled option, neither with the mouse nor with the keyboard. So I suppose Selenium should not be able to select it too. Yes, a user can click a disabled option, but this action does not change the selected element, it's effectively a no-op.

@andreastt

This comment has been minimized.

Show comment
Hide comment
@andreastt

andreastt Jan 9, 2018

Member

Thanks for the clarification on behaviour. Just checking it is not meant to return an error when trying to click a disabled element.

Member

andreastt commented Jan 9, 2018

Thanks for the clarification on behaviour. Just checking it is not meant to return an error when trying to click a disabled element.

@whimboo

This comment has been minimized.

Show comment
Hide comment
@whimboo

whimboo Jan 10, 2018

Contributor

Please note that there is a difference between a select with and without the multiple flag. For multiple selects a disabled option can receive focus, while for the others it doesn't work. Here an example jsbin: https://jsbin.com/zebisixudu/1

Contributor

whimboo commented Jan 10, 2018

Please note that there is a difference between a select with and without the multiple flag. For multiple selects a disabled option can receive focus, while for the others it doesn't work. Here an example jsbin: https://jsbin.com/zebisixudu/1

@barancev

This comment has been minimized.

Show comment
Hide comment
@barancev

barancev Jan 10, 2018

@whimboo In this sample the disabled option can take focus but it still can't be selected.

(By the way, in Chrome and IE it can't take focus even in multi-select, it's Firefox specific behavior)

barancev commented Jan 10, 2018

@whimboo In this sample the disabled option can take focus but it still can't be selected.

(By the way, in Chrome and IE it can't take focus even in multi-select, it's Firefox specific behavior)

@whimboo

This comment has been minimized.

Show comment
Hide comment
@whimboo

whimboo Jan 10, 2018

Contributor

Interesting. I filed a Firefox bug for that.

Contributor

whimboo commented Jan 10, 2018

Interesting. I filed a Firefox bug for that.

andreastt added a commit to andreastt/webdriver that referenced this issue Jan 10, 2018

element click: prevent selectedness change on <option disabled>
WebDriver currently toggles the selectedness state of <option
disabled> elements.  Because we can interact with the containing
<select> element we should simulate the mouse interaction steps but
prevent it from changing the selectedness state.

Fixes: w3c#1187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment