::selection/::-moz-selection pseudo-element ignored on form controls

RESOLVED DUPLICATE of bug 183646

Status

()

Core
Layout: Form Controls
RESOLVED DUPLICATE of bug 183646
13 years ago
9 years ago

People

(Reporter: pete, Unassigned)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

916 bytes, text/html
Details
(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050430 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050430 Firefox/1.0+

It's ignored, but not quite really though. If you put something like this:

::-moz-selection {
	background-color:#EB0 !important;
	color:#fff !important;
}

in userContent.css, it uses these colors instead of the system colors except for
SELECT element, where selected text still uses the system colors.

Reproducible: Always

Steps to Reproduce:
(Reporter)

Comment 1

13 years ago
Created attachment 182363 [details]
testcase

ugly looking testcase, but it shows that you can replace colors, bg-colors, and
borders except for the selection color on form controls.
That's not a bug, IMHO; the select element's selection is not a text selection,
it's an item selection, and is therefore not covered by ::selection.
(Reporter)

Comment 3

13 years ago
Oops, you're right, authors should use option[selected] to style it. The rest of
the bug report still applies though.
Could you specify what behaviour you think should change for this bug report to
be considered fixed? I don't understand what there is here other than the
<select> case.
(Reporter)

Comment 5

13 years ago
On my machine, viewing this testcase, ::-moz-selection isn't being applied to
the textarea or type="text" input box when you highlight its text.
The only reason it works in userContent.css is because that applies to anonymous
content.  From a page's point of view, the text in a text input doesn't exist --
the text input is a replaced element.  So CSS doesn't apply to it.  I don't
think we should change that.

Comment 7

13 years ago
However, CSS3 explicitly say:

"This also applies, for example, to selected text within an editable text field."

http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#UIfragments
That requirement cannot be fulfilled, in general.

Comment 9

13 years ago
Not working in html:textarea is bug 183646.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 183646
You need to log in before you can comment on or make changes to this bug.