Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<a role="button"> is not vertically aligned with <button> in <nav> #496

Open
carlreinke opened this issue Mar 19, 2024 · 3 comments
Open

Comments

@carlreinke
Copy link

carlreinke commented Mar 19, 2024

Describe the issue

<a role="button"> is not vertically aligned with <button> in a <nav>.

Current Behavior

image

Expected Behavior

image

Reproduction URL

<head>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/[email protected]/css/pico.min.css" />
</head>
<body>
  <article>
    <nav>
      <ul>
        <li><a href="#">a</a></li>
        <li><button>button</button></li>
        <li><a href="#" role="button">a[role="button"]</a></li>
      </ul>
    </nav>
  </article>
</body>

Environment

Firefox on Windows 10

@carlreinke carlreinke changed the title <a role="button"> is not vertically aligned in <nav> <a role="button"> is not vertically aligned with <button> in <nav> Mar 19, 2024
@enzoclock
Copy link

+1 👍. There is a margin bottom for buttons that have one of the three [type="..."] properties, but not for the default button. I wonder if this behavior should be aligned

@cameronelliott
Copy link

Same issue here chrome Version 123.0.6312.105 on macbook apple silicon

@shuuji3
Copy link

shuuji3 commented Jun 9, 2024

The reason was that button has margin: 0 while [role=button] only has margin-bottom: 0 but margin-top is not 0.

For the above example, I was able to fix the margin issue by one of these additional CSS:

-button {
+button, [role=button] {
   margin: 0;
 }

or

 nav li [role=button], nav li [type=button], nav li button, nav li input:not([type=checkbox],[type=radio],[type=range],[type=file]), nav li select {
     height: auto;
     margin-right: inherit;
     margin-bottom: 0;
     margin-left: inherit;
     padding: calc(var(--pico-nav-link-spacing-vertical) - var(--pico-border-width)* 2) var(--pico-nav-link-spacing-horizontal);
 }

+nav li [role=button], nav li [type=button] {
+  margin-top: 0;
+}

I'm unfamiliar with the Pico CSS codebase, so I'm not confident about which approach is appropriate to fix this issue. Hope this helps fix this issue.

Before

Screenshot from 2024-06-09 17-00-44

Screenshot from 2024-06-09 17-01-24

After

Screenshot from 2024-06-09 17-01-49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants