Ver Fonte

fix: update auto-scroll requirements and tasks for ResizeObserver handling

Yuki Takei há 5 dias atrás
pai
commit
5bcf441e8d

+ 1 - 0
.kiro/specs/auto-scroll/design.md

@@ -297,6 +297,7 @@ const GROWI_IS_CONTENT_RENDERING_SELECTOR =
 - Initial JSX: `{[GROWI_IS_CONTENT_RENDERING_ATTR]: 'true'}` (unchanged pattern, new constant name)
 - Initial JSX: `{[GROWI_IS_CONTENT_RENDERING_ATTR]: 'true'}` (unchanged pattern, new constant name)
 - Update `SUPPORTED_ATTRIBUTES` in `remark-drawio.ts` to use new constant name
 - Update `SUPPORTED_ATTRIBUTES` in `remark-drawio.ts` to use new constant name
 - Update sanitize option to allow the new attribute name
 - Update sanitize option to allow the new attribute name
+- **ResizeObserver re-render cycle** (req 4.8): In the ResizeObserver handler, call `drawioContainerRef.current?.setAttribute(GROWI_IS_CONTENT_RENDERING_ATTR, 'true')` before `renderDrawioWithDebounce()`. The existing inner MutationObserver (childList) completion path already sets the attribute back to `"false"` after each render — no additional change needed there. This ensures layout shifts from post-initial-render size adjustments are detected by the auto-scroll system.
 
 
 ### MermaidViewer Modification
 ### MermaidViewer Modification
 
 

+ 1 - 0
.kiro/specs/auto-scroll/requirements.md

@@ -64,6 +64,7 @@ The following reviewer feedback is incorporated into these requirements:
 5. The attribute shall be included in the component's HTML sanitization allowlist so that it survives remark/rehype processing.
 5. The attribute shall be included in the component's HTML sanitization allowlist so that it survives remark/rehype processing.
 6. The CSS selector used by the auto-scroll system shall match only the "in progress" state (e.g., `[attr="true"]`), not the completed state.
 6. The CSS selector used by the auto-scroll system shall match only the "in progress" state (e.g., `[attr="true"]`), not the completed state.
 7. The following async-rendering components shall adopt the attribute protocol in this scope: DrawioViewer, MermaidViewer, and lsx (Lsx). Other async renderers (PlantUML, attachment-refs, RichAttachment) are deferred to follow-up work.
 7. The following async-rendering components shall adopt the attribute protocol in this scope: DrawioViewer, MermaidViewer, and lsx (Lsx). Other async renderers (PlantUML, attachment-refs, RichAttachment) are deferred to follow-up work.
+8. When a component triggers a secondary re-render that will cause a layout shift (e.g., via ResizeObserver detecting container size changes after initial render), the component shall reset the attribute value to `"true"` before the re-render begins and allow the existing completion path to set it back to `"false"` when done. This ensures the auto-scroll system tracks all layout-shifting render cycles, not only the initial one.
 
 
 ### Requirement 5: Page-Type Agnostic Design
 ### Requirement 5: Page-Type Agnostic Design
 
 

+ 2 - 1
.kiro/specs/auto-scroll/tasks.md

@@ -11,7 +11,8 @@
   - Change rendering-complete and error paths to set the attribute value to `"false"` instead of removing the attribute entirely
   - Change rendering-complete and error paths to set the attribute value to `"false"` instead of removing the attribute entirely
   - Update the initial JSX spread to use the renamed constant while keeping `"true"` as the initial value
   - Update the initial JSX spread to use the renamed constant while keeping `"true"` as the initial value
   - Verify that the wrapper component (DrawioViewerWithEditButton) continues to function without changes
   - Verify that the wrapper component (DrawioViewerWithEditButton) continues to function without changes
-  - _Requirements: 4.3, 4.4_
+  - In the ResizeObserver handler, set `attr="true"` before `renderDrawioWithDebounce()` to signal re-render cycles to the auto-scroll system (req 4.8)
+  - _Requirements: 4.3, 4.4, 4.8_
 - [x] 2.2 (P) Update remark-drawio plugin sanitization and node rewriting
 - [x] 2.2 (P) Update remark-drawio plugin sanitization and node rewriting
   - Replace the old constant in the supported-attributes array with the new constant name
   - Replace the old constant in the supported-attributes array with the new constant name
   - Update node rewriting to set the new attribute name with `"true"` value on drawio nodes
   - Update node rewriting to set the new attribute name with `"true"` value on drawio nodes