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)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: janjongboom, Unassigned)

References

Details

Attachments

(1 file)

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.
Blocks: 847763
Tim, do you know who to dispatch this to? It blocks OOP work for keyboard.
Flags: needinfo?(timdream)
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.
> 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.
Attached video Video of the magic happening (deleted) —
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)
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...
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)
In that case let's hope that Tim knows someone who is a nsEventStateManager magician.
Unfortunately I know nothing about that part of Gecko.
Flags: needinfo?(timdream) → needinfo?(21)
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)
No longer blocks: 847763
It sounds like a bug to me, but Olli Pettay is probably a better person to ask.
Flags: needinfo?(roc) → needinfo?(bugs)
Comment 6 is obviously right. And this feels like a bug to me.
Flags: needinfo?(bugs)
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)
I tested this from browser.
But I'm pretty sure it didnt work in keyboard iframe either because thats how I got to this bug.
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?
Flags: needinfo?(bugs)
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)
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.

Attachment

General

Created:
Updated:
Size: