Skip to content

Commit 2372601

Browse files
authored
Refactor/v3 (#162)
* Feature/display (#155) * refactor: notification system * add: support for innerblock validation on parent * add: tooltips css file * fix: lint errors * fix: lint errors * remove: per-block inspector messages * add: plugin icon * change: only 1 editor validation headings on settings page * chnage: post meta sidebar validation styles * change: meta field styles * refactor: meta validation implementation * change: meta validation display * refactor: plugin structure (#149) * update: docs * finish: post meta validation styles * Cleanup/old code (#156) * change: removed css * refactor: script folders * remove: duplicate functionality * add: comments * add: utility functions for shared validation config (#159) * change: nvm * change: nvm * Feature/popover (#160) * change: removed popover, replaced with modal * finish: inline editor notifications * change: notification modal * Feature/sidebar (#161) * change: sidebar icon style * change: validation sidebar icon * refactor: sidebar message display * change: sidebar icon styles * change: validation sidebar styles * change: validation sidebar styles * fix: core block validation issues * fix: issue with body classes * change: sidebar styles * change: meta issue display in sidebar * finish: validation sidebar
1 parent e40eb5e commit 2372601

File tree

84 files changed

+5279
-2456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5279
-2456
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.11.0
1+
20.19.6

DOCS.md

Lines changed: 0 additions & 218 deletions
This file was deleted.

PLAN.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Rework Message Display UX
2+
3+
## Overview
4+
5+
Replace the current clunky message display system (PluginDocumentSettingPanel and inline meta field wrappers) with a modern, native-feeling UX that includes:
6+
7+
1. Clean inline indicators on blocks and meta fields (small icon badges in upper-left corner)
8+
2. Header toolbar button with issue count badge
9+
3. Unified PluginSidebar consolidating all issues
10+
4. Tooltip support for inline indicators
11+
5. Auto-scroll to blocks when clicking sidebar items
12+
13+
## Current State Analysis
14+
15+
**Current Implementation:**
16+
17+
- Block errors: Shown in `InspectorControls` (block sidebar) via `blockErrorComponent.js`
18+
- Editor errors: Shown in `PluginDocumentSettingPanel` via `EditorValidationDisplay.js`
19+
- Meta errors: Shown inline around fields via `ValidationDisplay.js` and `ValidatedToolsPanelItem.js`
20+
- Block indicators: Use `::after` pseudo-elements at `left: -50px` (outside block) - needs to be moved inside
21+
22+
**Files to Modify:**
23+
24+
- `src/scripts/components/EditorValidationDisplay.js` - Remove/replace PluginDocumentSettingPanel
25+
- `src/scripts/validation/blockErrorComponent.js` - Update block indicator positioning
26+
- `src/scripts/validation/ValidationDisplay.js` - Add meta field indicators
27+
- `src/styles/editor/block-icon.scss` - Redesign block indicators (move inside, smaller)
28+
- `src/styles/editor/meta-validation.scss` - Add meta field indicators
29+
- `src/scripts/registerPlugin.js` - Add new unified sidebar component
30+
31+
**New Files to Create:**
32+
33+
- `src/scripts/components/ValidationHeaderButton.js` - Header toolbar button with badge
34+
- `src/scripts/components/ValidationSidebar.js` - Consolidated sidebar
35+
- `src/scripts/components/BlockIndicator.js` - Inline block indicator component
36+
- `src/scripts/components/MetaIndicator.js` - Inline meta field indicator component
37+
- `src/scripts/components/ValidationTooltip.js` - Tooltip component for indicators
38+
- `src/styles/editor/validation-header.scss` - Header button styles
39+
- `src/styles/editor/unified-sidebar.scss` - Unified sidebar styles
40+
- `src/styles/editor/inline-indicators.scss` - Inline indicator styles
41+
42+
## Implementation Steps
43+
44+
### 1. Create Unified Validation Sidebar
45+
46+
- Consolidate block, editor, and meta validation issues into one `PluginSidebar`
47+
- Organize by type (errors vs warnings) and category (blocks, editor, meta)
48+
- Add click handlers to scroll to and select relevant blocks/fields
49+
- Use native Gutenberg components (`PanelBody`, `PanelRow`, etc.)
50+
51+
### 2. Create Header Toolbar Button
52+
53+
- Use Gutenberg SlotFill system to add button to editor header
54+
- Display badge count showing total errors/warnings
55+
- Auto-open sidebar when clicked
56+
- Use appropriate Gutenberg icon (warning/error icon)
57+
58+
### 3. Redesign Block Indicators
59+
60+
- Move indicators from `left: -50px` to inside block wrapper (upper-left corner)
61+
- Reduce size to ~16-20px icon badge
62+
- Position using absolute positioning within block wrapper
63+
- Add tooltip on click/hover showing issue summary
64+
- Remove old `::after` pseudo-element approach
65+
66+
### 4. Add Meta Field Indicators
67+
68+
- Create small icon badges for meta fields with validation issues
69+
- Position in upper-left corner of field wrapper
70+
- Match block indicator styling for consistency
71+
- Add tooltip support
72+
73+
### 5. Update Block Error Component
74+
75+
- Keep `InspectorControls` for detailed per-block info (optional, can be removed later)
76+
- Update wrapper classes to support new inline indicators
77+
- Ensure block highlighting still works for visual feedback
78+
79+
### 6. Remove/Deprecate Old Components
80+
81+
- Remove `EditorValidationDisplay` PluginDocumentSettingPanel usage
82+
- Keep validation logic but change display mechanism
83+
- Update meta field wrappers to use new indicator system
84+
85+
### 7. Styling Updates
86+
87+
- Modern, clean indicator design matching Gutenberg aesthetics
88+
- Proper z-index handling for indicators
89+
- Responsive behavior
90+
- Accessibility considerations (focus states, ARIA labels)
91+
92+
## Technical Considerations
93+
94+
**Gutenberg Components to Use:**
95+
96+
- `PluginSidebar` - For unified sidebar
97+
- `SlotFill` system - For header button (likely `PluginMoreMenuItem` or custom SlotFill)
98+
- `Popover` or `Tooltip` - For indicator tooltips
99+
- `PanelBody`, `PanelRow` - For sidebar organization
100+
- `Button` with `Badge` - For header button
101+
102+
**Data Management:**
103+
104+
- Reuse existing validation functions (`GetInvalidBlocks`, `GetInvalidMeta`, `GetInvalidEditorChecks`)
105+
- Create aggregated validation state hook for header button
106+
- Manage sidebar open/close state
107+
108+
**Block Selection/Scrolling:**
109+
110+
- Use `useSelect` to get block editor dispatch
111+
- Use `selectBlock` action to select blocks when clicking sidebar items
112+
- Implement smooth scrolling to selected blocks
113+
114+
## Testing Considerations
115+
116+
- Test with multiple blocks having issues
117+
- Test with editor-level and meta-level issues
118+
- Test tooltip interactions
119+
- Test sidebar scrolling/selection
120+
- Test responsive behavior
121+
- Verify accessibility (keyboard navigation, screen readers)

block-accessibility-checks.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@
2626
require_once __DIR__ . '/vendor/autoload.php';
2727

2828
// Imports the necessary classes for the plugin.
29-
use BlockAccessibility\PluginInitializer;
29+
use BlockAccessibility\Core\Plugin;
3030

3131
// Global variables for the plugin.
3232
$ba11yc_plugin_file = __FILE__;
3333
$ba11yc_text_domain = 'block-accessibility-checks';
3434

35-
// Initialize the PluginInitializer immediately (before 'init' hook).
35+
// Initialize the Plugin immediately (before 'init' hook).
3636
// This is required for HeadingLevels to register its filter early enough.
37-
$ba11yc_plugin_initializer = new PluginInitializer( $ba11yc_plugin_file, $ba11yc_text_domain );
37+
$ba11yc_plugin_initializer = new Plugin( $ba11yc_plugin_file, $ba11yc_text_domain );
3838

3939
/**
4040
* Initializes the Block Accessibility Checks plugin services.
4141
*
4242
* This function is called on the 'init' hook to complete plugin initialization
43-
* after HeadingLevels has been set up in the PluginInitializer constructor.
43+
* after HeadingLevels has been set up in the Plugin constructor.
4444
*
4545
* @return void
4646
*/

0 commit comments

Comments
 (0)