From 248c95b9d973d6733db3fc4580569628dbad1ca1 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Sat, 1 Aug 2026 17:29:44 -0400 Subject: [PATCH 01/14] refactor: colocate native inserter button styles Move the add block button rules out of the editor toolbar stylesheet and into a dedicated `native-inserter/style.scss`, matching the colocated stylesheet convention used by the other components. Pure move, no visual change. The selector remains scoped to the toolbar ancestor to preserve specificity over Gutenberg's button defaults. Co-Authored-By: Claude Opus 5 (1M context) --- src/components/editor-toolbar/index.jsx | 1 + src/components/editor-toolbar/style.scss | 13 +------------ src/components/native-inserter/index.jsx | 23 ++++++++++++++++++----- src/components/native-inserter/style.scss | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 src/components/native-inserter/style.scss diff --git a/src/components/editor-toolbar/index.jsx b/src/components/editor-toolbar/index.jsx index 886094046..d21e2d07e 100644 --- a/src/components/editor-toolbar/index.jsx +++ b/src/components/editor-toolbar/index.jsx @@ -100,6 +100,7 @@ const EditorToolbar = ( { className } ) => { const addBlockButton = enableNativeBlockInserter ? ( diff --git a/src/components/editor-toolbar/style.scss b/src/components/editor-toolbar/style.scss index 65851d24a..7514264a9 100644 --- a/src/components/editor-toolbar/style.scss +++ b/src/components/editor-toolbar/style.scss @@ -145,17 +145,6 @@ $scroll-indicator-elevation: 32; right: 6px; } -// Style the add block button with rounded black background -.gutenberg-kit-editor-toolbar .gutenberg-kit-add-block-button { +.gutenberg-kit-editor-toolbar__inserter { margin-inline-start: 8px; - - svg { - background: #eae9ec; - border-radius: 18px; - color: wordpress.$black; - padding: 1px; - width: 32px; - height: 32px; - display: block; - } } diff --git a/src/components/native-inserter/index.jsx b/src/components/native-inserter/index.jsx index bc348fcd4..dcb579278 100644 --- a/src/components/native-inserter/index.jsx +++ b/src/components/native-inserter/index.jsx @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +import clsx from 'clsx'; + /** * WordPress dependencies */ @@ -39,6 +44,7 @@ import useBlockTypesState from '@wordpress/block-editor/build-module/components/ /** * Internal dependencies */ +import './style.scss'; import { debug } from '../../utils/logger'; import { preprocessBlockTypesForNativeInserter, @@ -58,11 +64,16 @@ import { unlock } from '../../lock-unlock'; * * Mimics the WordPress Inserter component API with open/onToggle props. * - * @param {Object} props Component props - * @param {boolean} props.open Whether the inserter is open - * @param {Function} props.onToggle Callback to toggle inserter open state + * @param {Object} props Component props + * @param {string} props.className Optional CSS class for styling + * @param {boolean} props.open Whether the inserter is open + * @param {Function} props.onToggle Callback to toggle inserter open state */ -export default function NativeBlockInserterButton( { open, onToggle } ) { +export default function NativeBlockInserterButton( { + className, + open, + onToggle, +} ) { const buttonRef = useRef( null ); const prevOpen = useRef( false ); @@ -418,6 +429,8 @@ export default function NativeBlockInserterButton( { open, onToggle } ) { prevOpen.current = open; }, [ open, prepareAndShowInserter ] ); + const classes = clsx( 'gutenberg-kit-add-block-button', className ); + return (