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

Support sequential focus navigation #13460

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Follow hyperlinks when `Enter` is pressed

  • Loading branch information
nerith committed Sep 27, 2016
commit acdbb2ee334f7999be71f7c624cb71309a9889fa
@@ -20,11 +20,12 @@ use dom::event::Event;
use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::htmlimageelement::HTMLImageElement;
use dom::keyboardevent::KeyboardEvent;
use dom::mouseevent::MouseEvent;
use dom::node::{Node, document_from_node, window_from_node};
use dom::urlhelper::UrlHelper;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ReferrerPolicy;
use msg::constellation_msg::{Key, ReferrerPolicy};
use num_traits::ToPrimitive;
use script_traits::MozBrowserEvent;
use std::default::Default;
@@ -99,6 +100,20 @@ impl VirtualMethods for HTMLAnchorElement {
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
}
}

fn handle_event(&self, event: &Event) {

This comment has been minimized.

Copy link
@nox

nox Oct 17, 2016

Member

You didn't call the super type handle_event method.

if event.type_() == atom!("keydown") {
if let Some(keyevent) =
event.downcast::<KeyboardEvent>() {
match keyevent.get_key() {
Some(Key::Enter) => {
follow_hyperlink(self.upcast::<Element>(), Some(String::new()), None);
},
_ => ()
}
}
}
}

This comment has been minimized.

Copy link
@nox

nox Oct 17, 2016

Member

Could that change come with a spec link?

}

impl HTMLAnchorElementMethods for HTMLAnchorElement {
@@ -559,7 +574,7 @@ fn is_current_browsing_context(target: DOMString) -> bool {
}

/// https://html.spec.whatwg.org/multipage/#following-hyperlinks-2
fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, referrer_policy: Option<ReferrerPolicy>) {
pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, referrer_policy: Option<ReferrerPolicy>) {

This comment has been minimized.

Copy link
@nox

nox Jan 20, 2017

Member

AFAIK this doesn't need to be public.

// Step 1: replace.
// Step 2: source browsing context.
// Step 3: target browsing context.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.