“-moz-user-focus” doesn't work

RESOLVED DUPLICATE of bug 894383

Status

()

Core
General
--
major
RESOLVED DUPLICATE of bug 894383
6 years ago
4 years ago

People

(Reporter: brito.pro, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
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 1.9.2.13 - 20101206143738

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

Reproducible: Always

Steps to Reproduce:
Run:

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

<window width="400" height="300"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

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

Expected Results:  
the textBox2 should not be focusable
(Reporter)

Comment 1

6 years ago
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.
I believe you should be using `ignore` instead of `none`:

https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-focus

Still, it looks like it is broken for touch events.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 894383
You need to log in before you can comment on or make changes to this bug.