Skip to content

Bug with vertical positioning of nested <ul>s #43355

Closed

Description

@webbedspace

Describe the bug:
Spotted on https://awbw.amarriner.com/. This uses nested <ul>s plus position:relative for its dropdown menus - however, a problem emerges on Servo w/r/t the second <ul> being too far down.

To Reproduce:

<!doctype html>
<style>
    div {
        display:inline-block;
        position:relative;
        border: 1px solid brown;
        background: tan;
        height: 40px;
    }
</style>
<ul>
    <div>
        Foo
        <ul>
        Bar
        </ul>
    </div>
</ul>

This ONLY works with both elements as <ul>.

Firefox
Image
Chrome
Image
Servo
Image

My theory is that the useragent CSS for browsers gives ul the good old padding-inline-start: 40px;, and somehow on Servo this is being applied twice to the second ul… even though that's the wrong axis.

Platform:
Servo latest

Activity

  1. added
    C-untriaged
    on Mar 17, 2026
  2. added
    C-has-manual-testcase
    and removed
    C-untriaged
    on Mar 17, 2026
  3. Loirooriol commented on Mar 18, 2026

    @Loirooriol
    Contributor

    dir, dl, menu, ol, ul { margin-top: 1em; margin-bottom: 1em; }
    :matches(dir, dl, menu, ol, ul) :matches(dir, dl, menu, ol, ul) {
    margin-top: 0; margin-bottom: 0;
    }

    Should just use :is().

    Firefox: https://searchfox.org/firefox-main/rev/804ffad3df416ac8418f3c0df7679a8fe3d718fa/layout/style/res/html.css#586-588,591-592,602,605-606,616-622

  4. added a commit that references this issue on May 11, 2026
    d57c320
  5. added a commit that references this issue on May 12, 2026
    18b7009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-layout/inlineC-has-manual-testcase

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions