CRT-1128 Fix Safari I-beam cursor over chart captions - #7206
Conversation
The accessibility text proxy for captions renders an SVG <text> element over the canvas. Safari shows the I-beam (text) cursor over SVG text on hover, so hovering a caption showed a text cursor despite the text being non-selectable. Force the default cursor on the proxy's <text> element to keep the arrow cursor.
|
✅ Codex review complete; no issues found View full reviewCRT-1128 Fix Safari I-beam cursor over chart captionsPR: #7206 SummaryThis PR adds a default cursor style to the SVG text element used by BoundedTextWidget to prevent Safari from showing an I-beam cursor over presentational caption text, with a focused unit test covering the style. FindingsP0: 0 | P1: 0 | P2: 0 | P3: 0 No issues found. VerdictAssessment: correct The change is narrowly scoped, matches the stated Safari cursor issue, and the added test verifies the exact DOM style applied to the SVG text element. I did not identify correctness, performance, security, maintainability, or developer experience issues introduced by the diff. Required Actions: None - ready to merge |
Live-test this PR in PlunkerPaste these two <script src="https://ag-grid.github.io/ag-charts/pr-7206/ag-charts-community.min.js"></script>
<script src="https://ag-grid.github.io/ag-charts/pr-7206/ag-charts-enterprise.min.js"></script>Bundles are removed automatically when the PR is closed. Updated on every push. |
https://ag-grid.atlassian.net/browse/CRT-1128
Problem
In Safari, hovering over a chart caption (title/subtitle/footnote) showed the I-beam (text) cursor instead of the default arrow, even though the caption text is not selectable.
Root cause
Captions create an accessibility text proxy (
BoundedTextWidget) layered over the canvas — an absolutely-positioned<div>containing an<svg><text>that mirrors the caption text for screenreaders. Safari renders the I-beam cursor over SVG<text>content on hover, and no cursor was being set on the proxy, so it defaulted to the text cursor over the glyphs.Fix
Force
cursor: defaulton the proxy's<text>element in theBoundedTextWidgetconstructor. The<text>is the element Safari computes the I-beam for, and (unlike the wrapper<div>) it is never re-styled byProxyInteractionService.initElement, so the cursor survives the proxy-creation flow. Accessibility is unaffected — role, content, bounds and listeners are unchanged; only the visual cursor changes.Test plan
<text>carriescursor: default.yarn nx build:types ag-charts-community,yarn nx lint ag-charts-communityand the new vitest test all pass.grouped-horizontal-bargallery example in Safari, hover the caption without first touching the series-area, and confirm the arrow cursor instead of the I-beam.Fix #CRT-1128