Skip to content

sr-only inside a div with overflow produces unwanted scroll in the document #12428

@pladaria

Description

@pladaria

What version of Tailwind CSS are you using?

latest from: https://cdn.tailwindcss.com

What build tool (or framework if it abstracts the build tool) are you using?

none

What version of Node.js are you using?

none

What browser are you using?

Chrome

What operating system are you using?

Linux

Reproduction URL

https://codepen.io/pladaria/pen/KKJyXjR

Describe your issue

sr-only inside a div with overflow produces unwanted scroll in the document.

image

After removing the sr-only class the document scroll disappears:

image

A workaround is to add a "large enough" negative positioning to the element, like left: -100000px; right: -100000px. Not sure whether this has a11y implications.

This could be a Chromium bug. Not reproduced in Firefox

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions