Skip to content

Truly independent web browser

LibWeb: Draw no default focus ring around `html` and `body`

Jelle Raaijmakersaec2fb7cddde
diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.css
index 365a6154f4f..40b0b27744c 100644
--- a/Libraries/LibWeb/CSS/Default.css
+++ b/Libraries/LibWeb/CSS/Default.css
@@ -361,6 +361,11 @@ rt {
outline: auto;
}
+/* This matches the behavior of other engines. */
+html:focus-visible, body:focus-visible {
+ outline-style: none;
+}
+
mark {
background: Mark;
color: MarkText;
diff --git a/Tests/LibWeb/Ref/expected/HTML/editable-body-has-no-focus-ring-ref.html b/Tests/LibWeb/Ref/expected/HTML/editable-body-has-no-focus-ring-ref.html
new file mode 100644
index 00000000000..4dd7337c7c3
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/HTML/editable-body-has-no-focus-ring-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<body>There should be no focus ring around this text.</body>
diff --git a/Tests/LibWeb/Ref/input/HTML/editable-body-has-no-focus-ring.html b/Tests/LibWeb/Ref/input/HTML/editable-body-has-no-focus-ring.html
new file mode 100644
index 00000000000..4593b1e5910
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/HTML/editable-body-has-no-focus-ring.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="match" href="../../expected/HTML/editable-body-has-no-focus-ring-ref.html">
+<style>
+ body {
+ caret-color: transparent;
+ }
+</style>
+<body contenteditable>There should be no focus ring around this text.
+<script>
+ document.body.focus();
+</script>
+</body>