Skip to content

script: basic inertness implementation - #48967

Merged
TimvdLippe merged 10 commits into
servo:mainfrom
skyz1:implement-inert
Oct 27, 2026
Merged

TimvdLippe merged 10 commits into
servo:mainfrom
skyz1:implement-inert

Conversation

@skyz1

@skyz1 skyz1 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

This implements inert elements. The PR supports both the inert attribute and the new interactivity property.

We follow geckos approach for implementing inertness using an internal -servo-inert property. This requires some changes to stylo: servo/stylo#497

Currently, there is the limitation that the page does not become inert when a dialog opens, as this depends on #43665.

Testing: Passes additional web platform tests.
Fixes: #19746

@skyz1
skyz1 force-pushed the implement-inert branch 3 times, most recently from 00b7256 to 30e9817 Compare October 17, 2026 13:58
@skyz1
skyz1 marked this pull request as ready for review October 17, 2026 14:11
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 17, 2026
Comment thread tests/wpt/include.ini Resolved
@skyz1 skyz1 mentioned this pull request Oct 19, 2026
@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Oct 19, 2026
rogerkorantenng pushed a commit to rogerkorantenng/servo that referenced this pull request Oct 19, 2026
This enables the inert tests in preperation for servo#48967.

Testing: This enables tests

Signed-off-by: Glenn Skrzypczak <[email protected]>

@Loirooriol Loirooriol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like the wrong approach, because ultimately, inertness is CSS-based: https://drafts.csswg.org/css-ui-4/#inertness

@skyz1

skyz1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member Author

This seems like the wrong approach, because ultimately, inertness is CSS-based: https://drafts.csswg.org/css-ui-4/#inertness

Thanks for pointing that out; that makes sense. I just wasn't familiar with that specification. So, if I understand correctly, the interactivity property is now backing the inert attribute and is used to actually implement the desired behaviour? Or does interactivity property set to inert just overwrite the inertness in the HTML spec?

@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Oct 20, 2026
@Loirooriol

Copy link
Copy Markdown
Contributor

The UA can still decide that some elements are inert. But authors can use CSS to also make more elements inert. So you need to check the computed style anyways. And since inertness gets propagated to flat tree descendants, it's just more convenient to just track it as an internal inherited CSS property, then you don't need to loop ancestors.

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/style/computed_style_extra_fields.json5;drc=2c2fa99df1aa9df5b1ea037bf96f70795a6555eb;l=1317-1338

https://searchfox.org/firefox-main/rev/fc216bdbdf04fca964b8f241844b0e6d048cc245/servo/components/style/properties/longhands.toml#1903-1912

@skyz1

skyz1 commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

The UA can still decide that some elements are inert. But authors can use CSS to also make more elements inert. So you need to check the computed style anyways. And since inertness gets propagated to flat tree descendants, it's just more convenient to just track it as an internal inherited CSS property, then you don't need to loop ancestors.

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/style/computed_style_extra_fields.json5;drc=2c2fa99df1aa9df5b1ea037bf96f70795a6555eb;l=1317-1338

https://searchfox.org/firefox-main/rev/fc216bdbdf04fca964b8f241844b0e6d048cc245/servo/components/style/properties/longhands.toml#1903-1912

Yeah, that makes sense. Do we have something similar going on for other stuff already? Would I need to tap into stylo for that?

@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Oct 22, 2026
Signed-off-by: Glenn Skrzypczak <[email protected]>

± Conflicts:
±	tests/wpt/meta/inert/inert-iframe-tabbing.html.ini
±	tests/wpt/meta/inert/inert-inlines-around-selection-range-in-contenteditable.html.ini
±	tests/wpt/meta/inert/inert-node-is-uneditable.html.ini
±	tests/wpt/meta/inert/inert-on-non-html.html.ini
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Oct 22, 2026
@TimvdLippe TimvdLippe added the T-linux-wpt Do a try run of the WPT label Oct 25, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Oct 25, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#40169656021) for Linux (WPT)

Co-authored-by: Tim van der Lippe <[email protected]>
Signed-off-by: Glenn Skrzypczak <[email protected]>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 25, 2026
skyz1 added 5 commits October 25, 2026 22:05
Signed-off-by: Glenn Skrzypczak <[email protected]>
Signed-off-by: Glenn Skrzypczak <[email protected]>
Signed-off-by: Glenn Skrzypczak <[email protected]>
Signed-off-by: Glenn Skrzypczak <[email protected]>
@skyz1

skyz1 commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

It would also be good to understand why html/semantics/interactive-elements/the-dialog-element/inert-node-is-unfocusable.html now errors.

I ran the test on main aswell and there it also does not error locally. However, it seems to error on CI. No idea why...

It seems it has something to do with webdriver and I am not familiar with that, so I asked claude to investigate. Claude suggested we are wrongfully reporting the picker as a WebDriver user prompt. However, no idea if this makes sense, I have not clue about webdriver.

Signed-off-by: Glenn Skrzypczak <[email protected]>
@skyz1

skyz1 commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

This PR now reuses -moz-inert as @Loirooriol requested.

@TimvdLippe

Copy link
Copy Markdown
Contributor

The Stylo PR would first need to be merged and then we can merge this one.

@mrobinson

Copy link
Copy Markdown
Member

The Stylo PR would first need to be merged and then we can merge this one.

It should merge momentarily now.

Comment thread Cargo.toml Resolved
Signed-off-by: Glenn Skrzypczak <[email protected]>
@TimvdLippe TimvdLippe added the T-linux-wpt Do a try run of the WPT label Oct 27, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Oct 27, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#40471661643) for Linux (WPT)

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from try job (#40471661643):

Flaky unexpected result (21)
  • FAIL [expected PASS] /css/css-backgrounds/background-size-041.html
  • OK /css/css-flexbox/text-as-flexitem-size-001.html (#47104)
    • FAIL [expected PASS] subtest: .flexbox &gt; div 1

      assert_equals: 
      &lt;div data-expected-width="70" data-expected-height="35"&gt;
              &lt;p&gt;xx xxx&lt;/p&gt;
              &lt;p&gt;xx&lt;/p&gt;
            &lt;/div&gt;
      width expected 70 but got 46
      

    • FAIL [expected PASS] subtest: .flexbox &gt; div 2

      assert_equals: 
      &lt;div data-expected-width="50" data-expected-height="45"&gt;
              &lt;p&gt;xx xxx&lt;/p&gt;
              &lt;p&gt;xx&lt;/p&gt;
            &lt;/div&gt;
      width expected 50 but got 46
      

    • FAIL [expected PASS] subtest: .flexbox &gt; div 5

      assert_equals: 
      &lt;div style="height: 30px" data-expected-width="70" data-expected-height="30"&gt;
              &lt;p&gt;xx xxx&lt;/p&gt;
              &lt;p&gt;xx&lt;/p&gt;
            &lt;/div&gt;
      width expected 70 but got 46
      

    • FAIL [expected PASS] subtest: .flexbox &gt; div 8

      assert_equals: 
      &lt;div style="min-height: 40px" data-expected-width="70" data-expected-height="40"&gt;
              &lt;p&gt;xx xxx&lt;/p&gt;
              &lt;p&gt;xx&lt;/p&gt;
            &lt;/div&gt;
      width expected 70 but got 46
      

    • FAIL [expected PASS] subtest: .flexbox &gt; div 11

      assert_equals: 
      &lt;div style="max-height: 20px" data-expected-width="70" data-expected-height="20"&gt;
              &lt;p&gt;xx xxx&lt;/p&gt;
              &lt;p&gt;xx&lt;/p&gt;
            &lt;/div&gt;
      width expected 70 but got 46
      

  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 0deg' should prefer 'oblique 5deg' over 'oblique 15deg 20deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • FAIL [expected PASS] /css/css-image-animation/image-animation-img-running-to-normal.html (#46567)
  • TIMEOUT [expected PASS] /dom/nodes/moveBefore/moveBefore-range-iframe-crash.html
  • OK /fetch/h1-parsing/h1-parsing.tentative.html?include=in-value
    • PASS [expected FAIL] subtest: COLON at &lt;in-value&gt; should result in Network Error frame
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.html (#48205)
    • TIMEOUT [expected FAIL] subtest: Cross-origin top navigation is blocked without user activation, even if the parent has user activation

      Test timed out
      

  • TIMEOUT /html/browsers/history/the-history-interface/001.html (#12580)
    • PASS [expected FAIL] subtest: traversing history must also traverse hash changes
  • CRASH [expected OK] /html/browsers/history/the-location-interface/assign-replace-from-iframe.html (#47679)
  • CRASH [expected OK] /html/browsers/history/the-location-interface/security_location_0.htm (#48200)
  • CRASH [expected OK] /html/browsers/sandboxing/sandbox-initial-empty-document-toward-same-origin.html (#35948)
  • TIMEOUT [expected OK] /html/browsers/windows/consume-user-activation/window-open-multi-global.html (#47399)
    • TIMEOUT [expected FAIL] subtest: window.open() and consuming user activation with multiple globals in play

      Test timed out
      

  • OK [expected TIMEOUT] /html/semantics/embedded-content/media-elements/autoplay-disabled-by-permissions-policy.https.sub.html (#46012, #46804)
    • FAIL [expected TIMEOUT] subtest: Permissions-Policy header: autoplay "none" disallows same-origin iframes.

      assert_false: autoplay expected false got true
      

  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • CRASH [expected OK] /html/webappapis/dynamic-markup-insertion/opening-the-input-stream/remove-initial-about-blankness.window.html (#47638)
  • OK /infrastructure/testdriver/click_iframe.html (#47688)
    • FAIL [expected PASS] subtest: TestDriver click on a document in an iframe

      Unhandled rejection: assert_unreached: click failed Reached unreachable code
      

  • TIMEOUT [expected OK] /pointerevents/compat/pointerevent_touch-action_two-finger_interaction.html
    • NOTRUN [expected PASS] subtest: touch two-finger pan on 'touch-action: pan-x pan-y'
    • NOTRUN [expected FAIL] subtest: touch two-finger pan on 'touch-action: pinch-zoom'
  • OK /pointerevents/pointerevent_pointercapture_in_frame.html?pen (#45536)
    • FAIL [expected PASS] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture.

      assert_true: Timed out waiting for lostpointercapture expected true got false
      

    • FAIL [expected PASS] subtest: Test penpointer capture in same-origin frame: Pointer down at inner frame and set pointer capture to outer frame should not capture.

      assert_array_equals: Received events: innerFrame received pointerdown,innerFrame received pointermove,innerFrame received pointerup,innerFrame received lostpointercapture lengths differ, expected array ["innerFrame received pointerdown", "innerFrame received pointermove", "innerFrame received pointerup"] length 3, got ["innerFrame received pointerdown", "innerFrame received pointermove", "innerFrame received pointerup", "innerFrame received lostpointercapture"] length 4
      

  • OK /preload/prefetch-document.html (#37210)
    • FAIL [expected PASS] subtest: different-site document prefetch with 'as=document' should not be consumed

      assert_equals: expected 2 but got 1
      

  • OK /upgrade-insecure-requests/gen/sharedworker-classic-data.meta/upgrade/websocket.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for websocket to cross-ws-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects allowed for websocket to same-ws-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'allowed'. expected "allowed" but got "blocked"
      

  • OK /webdriver/tests/classic/perform_actions/pointer_mouse.py
    • FAIL [expected PASS] subtest: test_down_closes_browsing_context[without up]

      Failed: DID NOT RAISE &lt;class 'webdriver.error.NoSuchWindowException'&gt;
      

    • FAIL [expected PASS] subtest: test_click_navigation

      webdriver.error.NoSuchElementException: no such element (404)
      

Stable unexpected results that are known to be intermittent (9)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin-fragment.html (#20768)
    • FAIL [expected PASS] subtest: Tests that a fragment navigation in the unload handler will not block the initial navigation

      assert_equals: expected "" but got "#fragment"
      

  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/form-submit-button-click.html (#44099)
    • FAIL [expected TIMEOUT] subtest: Replace before load, triggered by submitButton.click()

      assert_equals: expected "http://web-platform.test:8000/common/blank.html?thereplacement=" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/resources/code-injector.html?pipe=sub(none)&amp;code=%0A%20%20%20%20const%20form%20%3D%20document.createElement(%22form%22)%3B%0A%20%20%20%20form.action%20%3D%20%22%2Fcommon%2Fblank.html%22%3B%0A%0A%20%20%20%20const%20input%20%3D%20document.createElement(%22input%22)%3B%0A%20%20%20%20input.type%20%3D%20%22hidden%22%3B%0A%20%20%20%20input.name%20%3D%20%22thereplacement%22%3B%0A%20%20%20%20form.append(input)%3B%0A%0A%20%20%20%20const%20button%20%3D%20document.createElement(%22button%22)%3B%0A%20%20%20%20button.type%20%3D%20%22submit%22%3B%0A%20%20%20%20form.append(button)%3B%0A%0A%20%20%20%20document.currentScript.before(form)%3B%0A%20%20%20%20button.click()%3B%0A%20%20"
      

  • TIMEOUT /html/browsers/sandboxing/sandbox-window-open-srcdoc.html (#48863)
    • TIMEOUT [expected PASS] subtest: window.open('about:srcdoc') from sandboxed srcdoc doesn't crash.

      Test timed out
      

    • NOTRUN [expected PASS] subtest: popup is isolated from an isolated iframe
  • TIMEOUT [expected OK] /html/semantics/embedded-content/media-elements/autoplay-allowed-by-permissions-policy.https.sub.html (#46803)
    • TIMEOUT [expected PASS] subtest: Permissions-Policy header: autoplay * allows the top-level document.

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: Permissions-Policy header: autoplay * allows same-origin iframes.

      Test timed out
      

  • TIMEOUT /html/semantics/embedded-content/media-elements/autoplay-default-permissions-policy.https.sub.html (#46805)
    • PASS [expected TIMEOUT] subtest: Default "autoplay" feature policy ["self"] allows the top-level document.
  • OK /html/semantics/embedded-content/media-elements/media_fragment_seek.html (#24114)
    • PASS [expected FAIL] subtest: Video should seek to time specified in media fragment syntax
  • CRASH [expected OK] /html/semantics/forms/form-submission-0/form-submit-iframe-then-location-navigate.html (#29634)
  • OK /html/webappapis/user-prompts/print-during-unload.html (#35944)
    • FAIL [expected PASS] subtest: print() during unload

      assert_array_equals: expected property 1 to be "destination" but got "error: window.print is not a function" (expected array ["start", "destination"] got ["start", "error: window.print is not a function"])
      

  • OK /sanitizer-api/sanitizer-inert-document.html (#45260)
    • PASS [expected FAIL] subtest: Test whether setHTML loads the image.
    • FAIL [expected PASS] subtest: Test whether setHTMLUnsafe loads the image.

      promise_test: Unhandled rejection with value: "The server observed a request. It shouldn't have."
      

@github-actions

Copy link
Copy Markdown

✨ Try run (#40471661643) succeeded.

@TimvdLippe
TimvdLippe added this pull request to the merge queue Oct 27, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 27, 2026
Merged via the queue into servo:main with commit 74d4390 Oct 27, 2026
76 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 27, 2026
@skyz1
skyz1 deleted the implement-inert branch October 27, 2026 14:24
cradiy pushed a commit to cradiy/stylo that referenced this pull request Oct 28, 2026
/// Inertness is propagated using the internal `-moz-inert` property.
pub(crate) fn is_inert(&self) -> bool {
self.downcast::<Element>()
.and_then(Element::style)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that this can be called before style has been resolved.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loirooriol pushed a commit to servo/stylo that referenced this pull request Nov 9, 2026
@servo-highfive

Copy link
Copy Markdown

Someone thinks this change could be added to the monthly blog post! To help with this, we need someone to answer the following questions: 😄

  1. Who is most impacted by this change: users, Servo developers, embedders, or some other group?
  2. What observable difference does this change make?
  3. What preferences (if any) need to be enabled to observe this difference?
  4. What (if any) specific URLs are affected?

If this change is part of a broader feature/project please make sure the PR description contains a Fixes: #12345 or Part of: #12345 issue reference.

Please add @servo-highfive monthly update answer when answering these questions so the bot notices your answer (or just quote this comment).

Thanks for helping us prepare the monthly blog post! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

monthly update S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement inertness

6 participants