Bug 271814 - Web Inspector: Editing a nested @media rule's media type from style details panel errs
Summary: Web Inspector: Editing a nested @media rule's media type from style details p...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: Safari Technology Preview
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-03-27 18:56 PDT by Qianlang Chen
Modified: 2024-03-27 18:56 PDT (History)
2 users (show)

See Also:


Attachments
Demo test case (317 bytes, text/html)
2024-03-27 18:56 PDT, Qianlang Chen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Qianlang Chen 2024-03-27 18:56:33 PDT
Created attachment 470631 [details]
Demo test case

If you have a nested @media rule like this:
    body {
        @media (min-width: 800px) {
            color: navy;
        }
    }

Then from the inspector's style details panel, editing the `(min-width: 800px)` part is allowed, but (in local build) the inspector throws an error when you press Enter or change input focus:
    TypeError:​ undefined is not an object (evaluating 'this._selectorTextField.startEditing')​ (at SpreadsheetCSSStyleDeclarationSection.js:​832:​36)​
        _handleSpreadsheetGroupingFieldWillNavigate @ SpreadsheetCSSStyleDeclarationSection.js:​832:​36
        spreadsheetRuleHeaderFieldWillNavigate @ SpreadsheetCSSStyleDeclarationSection.js:​243:​61
        _handleBlur @ SpreadsheetRuleHeaderField.js:​120:​69
        blur @ [native code]​
        _handleKeyDown @ SpreadsheetRuleHeaderField.js:​141:​31

Notably, nesting the @media rule the opposite way like this works just fine:
    @media (min-width: 800px) {
        body {
            color: navy;
        }
    }

No issues while editing any part of that style.

See attached for a test case.
Comment 1 Radar WebKit Bug Importer 2024-03-27 18:56:47 PDT
<rdar://problem/125523969>