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

bug(web): HTMLElement.focus() lacks proper touch-oriented handling. #598

Closed
jahorton opened this issue Feb 14, 2018 · 2 comments
Closed
Milestone

Comments

@jahorton
Copy link
Contributor

KMW presently relies entirely upon the touchstart event for touch-based control focusing, which can present an issue to pages wishing to use the HTMLElement.focus() function to focus a given control programatically.

Discovered during work on the engine tester PR, #585.

@jahorton
Copy link
Contributor Author

jahorton commented Mar 6, 2018

This gets a bit tricky because of various design decisions, some of which aren't ours. It's not too bad with current functionality, but becomes very tricky should we ever wish to extend what controls we can alias for mobile devices.

Cases:

  • Base element is either <input> or <textarea>
    • When .disabled is set to true, the elements cannot receive focus events. (We currently set this on the base element.)
    • However, .readonly allows focus events; just not editing. Setting .tabIndex=-1 will prevent tabs from focusing the base .readonly control.
  • Base element is .contentEditable
    • This element can only receive focus events when .contentEditable = true, so disabling it on the base element would be no help.
    • .contentEditable = true completely ignores any .disabled and .readonly settings on the element. It would require careful event management of the control to prevent edits to the 'base' rather than the 'alias.'

There is one alternative that allows elements to receive focus, according to online docs: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onfocus. The problem - this opens the elements up to receiving focus via 'tab'.

@mcdurdin mcdurdin added this to the 11.0 stable milestone Mar 9, 2018
@mcdurdin mcdurdin modified the milestone: Future Jun 29, 2018
@jahorton jahorton added this to the Future milestone Dec 6, 2018
@mcdurdin mcdurdin changed the title HTMLElement.focus() lacks proper touch-oriented handling. [web] HTMLElement.focus() lacks proper touch-oriented handling. Apr 22, 2019
@jahorton jahorton modified the milestones: Future, A16S13 Oct 28, 2022
@jahorton
Copy link
Contributor Author

As of #7343, we've now laid touch-alias elements to rest. As a result... we no longer need to disable the 'base' elements, removing this issue entirely.

@mcdurdin mcdurdin changed the title [web] HTMLElement.focus() lacks proper touch-oriented handling. bug(web): HTMLElement.focus() lacks proper touch-oriented handling. Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants