From 0ba93366ff1429d0b0f602ae6c2b6ca64d2b66f5 Mon Sep 17 00:00:00 2001 From: Jiri Swen Date: Thu, 19 Nov 2020 09:56:05 +0100 Subject: [PATCH 1/8] Allow user defined focused outline offset to be 0 --- src/floating-focus.js | 3 +-- src/floating-focus.scss | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/floating-focus.js b/src/floating-focus.js index af70626..1b5cec1 100644 --- a/src/floating-focus.js +++ b/src/floating-focus.js @@ -187,8 +187,7 @@ export default class FloatingFocus { getFloaterPosition(target) { const targetStyle = window.getComputedStyle(target); - // default 4 px padding - const padding = parseFloat(targetStyle.outlineOffset) || 4; + const padding = parseFloat(targetStyle.outlineOffset); const rect = target.getBoundingClientRect(); this.previousTargetRect = rect; diff --git a/src/floating-focus.scss b/src/floating-focus.scss index 85fc0e1..5ef1388 100644 --- a/src/floating-focus.scss +++ b/src/floating-focus.scss @@ -46,3 +46,8 @@ border: 0 !important; } } + +.floating-focus-enabled :focus, .floating-focus-enabled .focus { + // default 4px padding. Can be overwritten + outline-offset: 4px; +} From 4778f4ea97006f365f0bafc4330dce832683a78d Mon Sep 17 00:00:00 2001 From: Jiri Swen Date: Thu, 19 Nov 2020 10:01:45 +0100 Subject: [PATCH 2/8] Add some outline styling test stuff to example.html --- example/index.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/example/index.html b/example/index.html index ab8dcf6..287e43b 100644 --- a/example/index.html +++ b/example/index.html @@ -73,7 +73,13 @@ label { position: relative; overflow: hidden; - outline-style: dashed !important; + } + + .file-upload-label.focus { + outline-offset: 8px; + outline-color: orange; + outline-width: 2px; + outline-style: dashed; } input[type="file"] { @@ -109,7 +115,7 @@ -