Last Comment Bug 627691 - “-moz-user-focus” doesn't work
: “-moz-user-focus” doesn't work
Status: RESOLVED DUPLICATE of bug 894383
Product: Core
Classification: Components
Component: General (show other bugs)
: unspecified
: x86_64 Linux
-- major (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
Depends on:
  Show dependency treegraph
Reported: 2011-01-21 05:17 PST by
Modified: 2013-11-25 08:01 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Description User image 2011-01-21 05:17:56 PST
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Ubuntu/10.04 Chromium/8.0.552.237 Chrome/8.0.552.237 Safari/534.10
Build Identifier: Mozilla XULRunner - 20101206143738

The CSS property “-moz-user-focus” doesn't work in my text field.

Reproducible: Always

Steps to Reproduce:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window width="400" height="300"

            <textbox id="textBox1"/>
            <textbox id="textBox2" style="-moz-user-focus: none;"/>
            <textbox id="textBox3"/>
Actual Results:  
the textBox2 is focusable

Expected Results:  
the textBox2 should not be focusable
Comment 1 User image 2011-01-26 04:08:56 PST
As a workaround, provided by Neil:

"The textbox itself never takes focus. Instead, XBL creates an anonymous XHTML input element inside the textbox, and this is what takes focus. You can stop the textbox taking keyboard focus by setting its tab index to -1, and mouse focus by preventing the default action of mousedown events.

Another approach is to set the textbox to disabled or readonly, depending on why you don't want the textbox to be focused."

Still, I think the -moz-focus should work as well, and should prevent both keyboard and mouse focus.
Comment 2 User image Sergi Mansilla [:sergi] (Telenor) [PTO] 2013-11-25 08:01:28 PST
I believe you should be using `ignore` instead of `none`:

Still, it looks like it is broken for touch events.

*** This bug has been marked as a duplicate of bug 894383 ***

Note You need to log in before you can comment on or make changes to this bug.