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

Add overflow: hidden and user-modify: none to inert style #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 77 additions & 39 deletions dist/inert.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/inert.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions inert.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@ function addInertStyle(node) {
" -webkit-user-select: none;\n" +
" -moz-user-select: none;\n" +
" -ms-user-select: none;\n" +
" overflow: hidden !important;\n" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

This forces a repaint; currently we have other css properties that are causing a repaint as well (see #21), but those are bugs on the browsers.

Also, on windows this will cause a scrollbar to disappear/appear, causing resizing of the content (change the layout of the content/text), and loose the scroll position.

I'm not sure on this one, @robdodson @alice WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does cause a repaint, but only once per inert root, rather than once per element inside the inert root.

The Windows issue is trickier, though. It seems like there's no good solution here currently.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Possible horrible idea that might not work...

Since you only need the overflow rule for Firefox, could you tuck it into a @supports block to limit the damage?

@supports (--moz-user-select: none) {
  [inert], [inert] * {
    overflow: hidden !important;
  }
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh that doesn't help the Windows issue though :P

Copy link
Member Author

Choose a reason for hiding this comment

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

So where are we on this? How much of a deal breaker is the scrollbar thing compared to leaving things focusable? Do we have any other options besides those two?

" user-modify: none !important;\n" +
Copy link
Collaborator

Choose a reason for hiding this comment

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

none is not a valid type for user-modify https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-modify
Also, it should have the -moz & -webkit prefix https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-user-modify

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, thanks! Changed to read-only and added -moz and -webkit versions.

"}\n";
node.appendChild(style);
}
Expand Down