Spatial Navigation: User should be able to navigate html elements having element.style.cursor="pointer"
Using cursor properties is common practice in Web development. Refer URL mentioned above; button is created using <span> which behaves like hyperlink.
As <span> is not focusable WebKit doesn’t draw focus ring. So to make <span> focusable element for spatial navigation, we need to adopt same approach mentioned in URL.
1. If any HTML element has style.cursor="pointer", consider it as candidate for Spatial Navigation.
2. If such element is chosen as best candidate, focus it by drawing border/outline around it.
Please let me know your comments ?
> Please let me know your comments ?
Sounds good with me. Does Opera 12 (pre-blink) do similarly?
I checked Opera V12.14, Opera doesn't support this feature.
We should implement it in Webkit.
Started working on it :)
Created attachment 213246 [details]
Comment on attachment 213246 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=213246&action=review
r-. See comments.
Also, a question: this property (cursor: point) seems inheritable. What happens if one does <body style="cursor:point"> ?
> +bool Element::isSpatialNavigationFocusable() const
> + if (!document().frame() && !document().frame()->settings().spatialNavigationEnabled())
> + return false;
> + if (!inDocument())
> + return false;
> + if (!renderer() || renderer()->style()->visibility() != VISIBLE)
> + return false;
> + return (renderer()->style()->cursor() == CURSOR_POINTER);
this does not belong to Element. See more below.
> + if (!element->isSpatialNavigationFocusable() && !element->isKeyboardFocusable(event) && !element->isFrameOwnerElement() && !canScrollInDirection(element, direction))
isSpatialNavigationFocusable belong, I believe to SpatialNavigation.h, and should likely be a static method, taking an Element*
Additionally, it should be named with cursor:point case in mind. isSpatialNavigationFocusable is too generic in this case. Maybe hasCursorPointStyle?
Is this behavior described in a spec anywhere?
No, this behavior is not belongs to spec
This change will improve user interaction using spatial Navigation.
(In reply to comment #5)
> Is this behavior described in a spec anywhere?
(In reply to comment #6)
> No, this behavior is not belongs to spec
> This change will improve user interaction using spatial Navigation.
Then I don't think it should be implemented. If it's specified, then it's OK to implement. We want interoperability between browsers.
I agree with your point about interoperability between browsers but we are implementing this feature only if the spatial navigation is enabled. If user enabled spatial navigation then only this behavior is enabled for him. I think this behavior will be helpful for user who wants to navigate WebPages using key navigation.
Moreover reasons to enable such behavior are,
1. To make spatial navigation more user interactive.
2. Opera browser already has this feature implemented. (Opera Version 12.14 using presto rendering engine) - http://www.opera.com/help/tutorials/nomouse/
<div style=”cursor: pointer” onclick=”navigateToUrl(‘www.google.com’)”> Click me</div>
(In reply to comment #7)
> (In reply to comment #6)
> > No, this behavior is not belongs to spec
> > This change will improve user interaction using spatial Navigation.
> Then I don't think it should be implemented. If it's specified, then it's OK to implement. We want interoperability between browsers.