Closed
Bug 894383
Opened 11 years ago
Closed 7 years ago
`-moz-user-focus: ignore` is broken for touch events
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: janjongboom, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
video/mp4
|
Details |
Considering this code:
<!DOCTYPE html>
<html>
<head>
<title>Test moz-user-focus</title>
<style>
#btn {
-moz-user-focus: ignore;
}
</style>
</head>
<body>
<button id="btn">Click me</button>
<input id="inp" type="text" value="hoi">
<script>
document.getElementById('btn').onclick = function() {
document.getElementById('inp').value = 'Click!';
};
</script>
</body>
</html>
When loading in FF Nightly this works fine. When clicking the button the input element keeps focus and the text changes.
In B2G desktop this also works fine.
On real FFOS device this doesn't work. The button gets the focus.
Reporter | ||
Comment 1•11 years ago
|
||
Tim, do you know who to dispatch this to? It blocks OOP work for keyboard.
Flags: needinfo?(timdream)
Reporter | ||
Comment 2•11 years ago
|
||
I think it has something to do with the code in nsEventStateManager.cpp around line 3092 that touch events aren't handled the same way.
Comment 3•11 years ago
|
||
> When loading in FF Nightly this works fine. When clicking the button the
> input element keeps focus and the text changes.
>
That's not correct. Changing the focusability of an element with -moz-focus-ignore only applies to xul elements. On Windows and Linux the button will be focused when clicking it. On Mac, it won't be, but this doesn't have anything to do with -moz-focus-ignore.
Reporter | ||
Comment 4•11 years ago
|
||
Neil, when I load this in FF Nightly on OSX it works w/o focussing. When removing the CSS line it does the focus. Please see this video (it's super low res, but you can see the difference with and without the line). Maybe this is the actual bug, but I don't know.
Flags: needinfo?(enndeakin)
Reporter | ||
Comment 5•11 years ago
|
||
Just checked this on WinXP and indeed there -moz-user-focus doesn't do anything. However it actually works on normal web pages in OSX, and it also works in FFOS Simulator (also on OSX) as long as you do mouse-events. And normal behavior restores if removing the CSS line...
Comment 6•11 years ago
|
||
Ah, ok, you're referring to the clearing of focus which is the only behaviour of -moz-user-focus that still applies to html elements (which could be considered a bug).
Note that the button doesn't receive focus in either case on Mac, the focus is cleared in one case (set to nothing) and left on the <input> in the other. Also, on Windows on Linux though, setting -moz-user-focus has no effect on the testcase.
Anyway, comment 2 is correct if you want to change this.
Flags: needinfo?(enndeakin)
Reporter | ||
Comment 7•11 years ago
|
||
In that case let's hope that Tim knows someone who is a nsEventStateManager magician.
Comment 8•11 years ago
|
||
Unfortunately I know nothing about that part of Gecko.
Flags: needinfo?(timdream) → needinfo?(21)
Comment 9•11 years ago
|
||
Here we overrides the tabIndex (-1) that passed down to nsGenericHTMLElement::IsHTMLFocusable to indicate that the element has -moz-user-focus: ignore.
http://dxr.mozilla.org/mozilla-central/source/content/html/content
/src/nsGenericHTMLElement.cpp#l2865
So the <input> or <button> will always get the focus. I'm not sure if it's a bug or not, maybe roc knows?
Flags: needinfo?(roc)
It sounds like a bug to me, but Olli Pettay is probably a better person to ask.
Flags: needinfo?(roc) → needinfo?(bugs)
Comment 11•11 years ago
|
||
Comment 6 is obviously right. And this feels like a bug to me.
Flags: needinfo?(bugs)
Comment 12•11 years ago
|
||
Just curious, is this happening for App Window or for content rendered into the browser app? There are different code paths involved here.
Flags: needinfo?(21)
Reporter | ||
Comment 13•11 years ago
|
||
I tested this from browser.
Reporter | ||
Comment 14•11 years ago
|
||
But I'm pretty sure it didnt work in keyboard iframe either because thats how I got to this bug.
Comment 16•11 years ago
|
||
As said in comment 3 and comment 6, -moz-user-focus does not really works for HTML elments.
@smuag, Hixie said something like pointer-events:no-focus in https://www.w3.org/Bugs/Public/show_bug.cgi?id=23543 and I think I like it, how do you think?
Updated•11 years ago
|
Flags: needinfo?(bugs)
Comment 17•11 years ago
|
||
Not sure pointer-events css property is the quite right tool.
pointer-events is effectively a filter to hit testing, but with focus handling we'd want to change
the handling of the event (which happens after hit testing has selected some target).
Flags: needinfo?(bugs)
Comment 18•7 years ago
|
||
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•