Skip to content
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

Browser.Dom.Focus returns an Ok on disabled element #106

Open
Confidenceman02 opened this issue Mar 27, 2020 · 0 comments
Open

Browser.Dom.Focus returns an Ok on disabled element #106

Confidenceman02 opened this issue Mar 27, 2020 · 0 comments

Comments

@Confidenceman02
Copy link

Confidenceman02 commented Mar 27, 2020

The Story

Say we have a button in a view `button[id "SomeId"][text "Button"].

Programatically focussing on that button with a Cmd like -
Task.attempt focusMsg (BrowserDom.focus "SomeId")
will produce a Result that will resolve to Ok ().

This makes sense, the button is in the view with a matching id, we found that button and focused on it. Awesome!

Now say we disable the button
button[id "SomeId", disabled True][text "Button"]

This button will not be able to receive focus, the DOM wont allow it and it is expected behaviour.

Lets say what the hoot, lets try and focus on it anyway, so we do -
Task.attempt focusMsg (BrowserDom.focus "SomeId")

Interestingly the Result resolves to Ok (). But wait.. the button cannot receive focus, nor did it in the view..

It seems the 'Ok ()' has more to do with the fact the element was found, not that it received focus which to me seems like an opportunity.

Whilst I understand the DOM's focus does not give us feedback that something was indeed successfully focused I believe it could be implemented and provide a pretty sweet guarantee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant