Bug 38927 - Make the :window-inactive pseudo class apply to everything (or atleast the body/root element)
Summary: Make the :window-inactive pseudo class apply to everything (or atleast the bo...
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-05-11 12:32 PDT by Timothy Hatcher
Modified: 2024-01-25 17:44 PST (History)
13 users (show)

See Also:


Attachments
[TEST] Reduction (126 bytes, text/html)
2014-08-14 20:34 PDT, Joseph Pecoraro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2010-05-11 12:32:15 PDT
Right now scrollbars and selection work with window-inactive. But it would be useful for other things, at least the body/root element.


From CSSStyleSelector.cpp:

    // FIXME: This is a temporary hack for resizers and scrollbar corners.  Eventually :window-inactive should become a real
    // pseudo class and just apply to everything.
Comment 1 Joseph Pecoraro 2014-08-14 20:34:32 PDT
Created attachment 236642 [details]
[TEST] Reduction

Hey! It seems like this selector now works for any element because of:
http://trac.webkit.org/changeset/172220

However it seems that querySelector identifies the elements, but the elements do not recalculate style and repaint. For example (attached test):

    <style>
    div { width: 200px; height: 200px; background: blue; }
    div:window-inactive { background: red; }
    </style>

    <div></div>

Note when inspector is focused that querySelector("div:window-inactive") finds the div. But the div is not red =(
Comment 2 Ahmad Saleem 2022-07-27 13:58:19 PDT
I am able to reproduce this bug in Safari 15.6 on macOS 12.5 using attached test case and it shows "Red" square / box while all other browsers (Chrome Canary 106 & Firefox Nightly 105) show "Blue" square / box. Thanks!
Comment 3 Radar WebKit Bug Importer 2022-07-27 17:53:17 PDT
<rdar://problem/97693996>
Comment 4 Ahmad Saleem 2023-10-10 09:24:00 PDT
Seems to be fixed in Safari 17 and Safari Technology Preview 180 and show 'Blue' square.

Marking this as 'RESOLVED CONFIGURATION CHANGED'. It might be fixed by Anne's selector serialization bug.

Although happy if some can do triage and add related commits detail, where this get fixed.
Comment 5 Timothy Hatcher 2024-01-24 19:02:01 PST
Not fixed. The div should be blue when the window is focused, and red when it is in the background.
Comment 6 Tim Nguyen (:ntim) 2024-01-25 17:44:22 PST
I don't think we should pursue this, we should instead look into standardizing a media query https://github.com/w3c/csswg-drafts/issues/5828