diff --git a/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js b/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js index f2eb4f4cb6b0a..b9fc9b6e0b57f 100644 --- a/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js +++ b/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js @@ -68,8 +68,12 @@ export default function AutoSizeInput({ return; } + // Adding an extra pixel avoids a slight horizontal scroll when changing text selection/cursor. + // Not sure why this is, but the old DevTools did a similar thing. + const targetWidth = Math.ceil(scrollWidth) + 1; + if (inputRef.current !== null) { - inputRef.current.style.width = `${scrollWidth}px`; + inputRef.current.style.width = `${targetWidth}px`; } }, [value]); diff --git a/src/devtools/views/Components/NativeStyleEditor/StyleEditor.css b/src/devtools/views/Components/NativeStyleEditor/StyleEditor.css index a097665581b71..bbaaf16ea5829 100644 --- a/src/devtools/views/Components/NativeStyleEditor/StyleEditor.css +++ b/src/devtools/views/Components/NativeStyleEditor/StyleEditor.css @@ -42,6 +42,12 @@ .Input { flex: 0 1 auto; + padding: 1px; + box-shadow: 0px 1px 3px transparent; +} +.Input:focus { + color: var(--color-text); + box-shadow: 0px 1px 3px var(--color-shadow); } .Empty {