Skip to content

Focus student project

Josh Matthews edited this page Jan 7, 2016 · 9 revisions

Improve document focus support

Status: claimed; talk to jdm before attempting to work on this project.

Background information: Keyboard focus is an important concept for many web applications. Servo currently supports only the bare minimum required to implement text input in form controls on web pages; this project will greatly improve the usability of sites containing forms for users who use the keyboard in order to quickly navigate through pages.

Initial step: build Servo, then mail the mozilla.dev.servo mailing list introducing your group.

Subsequent steps:

  • Create a sequential focus ordering list vector that is stored in the Document object. When new elements are added to the document (see bind_to_tree in element.rs), they should be added to this list in tree order if their SEQUENTIALLY_FOCUSABLE flag is set. (See #5858 for details on this flag, which is also called the "tabindex focus flag.")
  • Add a handle_event implementation (of the VirtualMethods trait) for the Document object that processes tab and shift + tab key events. This should cause the document focus to transition to the next (or previous) element present in the sequential list, and wrap around when the list is exhausted.
  • Process the tabindex attribute according to the spec, such that the sequential focus ordering list is ordered correctly in the presence of tabindex. Use existing implementations of methods like parse_plain_attribute and attribute_mutated for inspiration.
  • Process the autofocus attribute on HTMLInputElement according to the spec.

TODO: implement click-based positioning too?

Clone this wiki locally