Skip to content

Commit

Permalink
Text selection: show CSS hack to Safari only. (#57300)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmussen authored Dec 21, 2023
1 parent cf476e2 commit 6e9c856
Showing 1 changed file with 14 additions and 10 deletions.
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;
}

.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

1 comment on commit 6e9c856

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 6e9c856.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7289630437
📝 Reported issues:

Please sign in to comment.