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

Text selection: show CSS hack to Safari only. #57300

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
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
24 changes: 14 additions & 10 deletions packages/block-editor/src/components/block-list/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,27 @@
}
}


// Hide selections on this element, otherwise Safari will include it stacked
// under your actual selection.
// This uses a CSS hack to show the rules to Safari only. Failing here is okay,
// it just makes the selection indication slightly less precise. That makes this
// hack a progressive enhancement. Stylelint is disabled to allow the hack to work.
/* stylelint-disable */
_::-webkit-full-page-media, _:future, :root .block-editor-block-list__layout::selection,
_::-webkit-full-page-media, _:future, :root .has-multi-selection .block-editor-block-list__layout::selection {
background-color: transparent;
}
/* stylelint-enable */


// Note to developers refactoring this, please test navigation mode, and
// multi selection and hovering the block switcher to highlight the block.
// Also be sure to test partial selections in Safari, as it draws the
// selection marker with an entirely different model than Blink.
.block-editor-block-list__layout {
position: relative;

// Hide selections on this element, otherwise Safari will include it stacked
// under your actual selection.
&::selection {
background: transparent;
Copy link
Member

Choose a reason for hiding this comment

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

Re-enabling this doesn't work in Chrome?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry can you clarify?

}

.has-multi-selection &::selection {
background: transparent;
}

// Block multi selection
// Apply a rounded radius to the entire block when multi selected, but with low specificity
// so explicit radii set by tools are preserved.
Expand Down
Loading