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

[cssom-view] Define steps / an algorithm perform a scroll in a given direction without an explicit position #2323

Open
frivoal opened this issue Feb 16, 2018 · 1 comment
Assignees

Comments

@frivoal
Copy link
Collaborator

frivoal commented Feb 16, 2018

While trying to define (in a part of https://wicg.github.io/spatial-navigation/ that will become a Pull Requestion against UI-Events when it matures) what happens when you press keys, and more specifically arrow keys, I've found myself wanting to refer to an algorithm that defines how to perform a scroll in a given direction without an explicit position. I thought I'd find it in CSSOM-View, but it wasn't there.

For now, I've rolled my own, but this feels like it does belong in CSSOM-VIEW.

@frivoal frivoal self-assigned this Feb 16, 2018
@anawhj
Copy link
Member

anawhj commented Mar 13, 2018

I agree that we probably need to define what happens when user presses keys. I could find some default behavior of arrow keys and enter key operated in major browsers below.

arrow keys

  • buttons (move the focus into other enighboring radio button)
  • textarea (move the cursor in the direction)
  • general document (scroll the page, if it overflows)

enter key

  • all buttons (invoke a click event)
  • hyperlink (invoke a click event)
  • input elements in a form (submit)
  • textarea (CRLF)

If we enable the spatial navigation in the browser, we should carefully set the priority for each key input.
You can see some behavior described above in the following example.
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5825

However, I'm not sure how to define the things rolled by @frivoal. It seems a natural result when scrolling in a given direction without an explicit position. If I change the default wheel offset in the control panel in Win10 and handle the wheel in the browser, it works as the operating system's settings. It's not for the browser, but for the underlying platform. The scroll offset change by the arrow key input would be different with the wheel case, but it also seems a natural result and not changeable by web engine as well as authors. I wonder how and where we could use the algorithm.

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