You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed onSwitchFrom from Trace interface — Y-value preservation now works generically through getCurrentYValue()/moveToXAndYValue() which both violin traces
implement
Orientation in instructions (src/model/context.ts, src/maidr-component.tsx)
Instruction text now includes orientation: "This is a maidr plot of type: horizontal box."
Added formatPlotType() helper — safely returns just the type name when orientation is absent (no extra spaces/artifacts)
Applied to both initial instruction (pre-focus) and runtime instruction (post-focus)
Added orientation?: Orientation to TraceState (src/type/state.ts)
PR Review: Horizontal Violin Plot Orientation Support
Overall, this is a solid PR that addresses a real gap in horizontal violin plot support. The architectural improvements (removing onSwitchFrom in favor of a generic getCurrentYValue/moveToXAndYValue path, caching audio reference values) are clean wins. A few issues worth addressing before merge:
Issues
1. formatPlotType is duplicated (maidr-component.tsx and context.ts)
The same helper is defined identically in two files. This is a DRY violation — if the logic changes once, the other copy will drift. Extract it to a shared utility (e.g., src/util/format.ts) and import from both locations.
If Orientation.HORIZONTAL === 'horz', this condition is always a duplicate check. If they differ, the string literal is an undocumented magic value. Either rely solely on the enum values, or document why raw strings must also be handled here (e.g., legacy data). Mixing both signals uncertainty about what orientation can actually contain at runtime.
The conditional adds no value — it unconditionally sets the flag to false regardless of its prior value. Simplify to:
this.isInitialEntry=false;
5. MIN_SPEED change (50ms → 10ms) is unrelated and potentially disruptive
-constMIN_SPEED=50;+constMIN_SPEED=10;
This changes global autoplay behavior for all plot types, not just violin. At 10ms between movements the autoplay will be extremely fast — likely imperceptible for audio. If this is intentional, it deserves its own PR with a rationale. If it's a side effect of working on the violin feature, it should be reverted here.
6. showOutliers removal from ViolinOptions is a breaking change
-/** Show outlier points. Default: true */-showOutliers?: boolean;
If any existing callers pass showOutliers: true/false in their violin configuration, removing this field silently discards their setting (TypeScript will warn but won't block). If outliers are genuinely not supported for violin plots, this removal is architecturally correct — but it should be documented clearly in the PR description as a breaking change and ideally guarded by a deprecation notice or migration path.
Minor Suggestions
autoplay getter visibility change (private → protected) is necessary for the ViolinKdeTrace override, and the use of method overriding here is the right pattern. Just make sure the base class contract is documented: subclasses overriding autoplay should return counts matching their actual navigation dimensions.
Navigation symmetry in ViolinKdeTrace.isMovable() and moveOnce(): The horizontal and vertical branches are structurally symmetric but fully duplicated. This is acceptable given the logic is small, but a swapRowCol() helper or parameterizing by (rowAxis, colAxis) would cut the code in half if more divergence is expected later.
Positives
Removing onSwitchFrom in favor of the generic getCurrentYValue/moveToXAndYValue path is a clear improvement — it follows KISS and avoids trace-type coupling in NavigationService.
Caching refSafeMin/refSafeMax at construction time is a correct performance optimization.
The speedUp fix (> → >=) is correct — the old code prevented userSpeed from ever reaching minSpeed.
Text state using mainAxis/crossAxis for orientation-aware labeling is the right abstraction.
Comments explaining navigation conventions (vertical vs horizontal) are helpful.
Please address items 1–5 before merging. Item 6 needs a decision on whether it's intentional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
Horizontal violin KDE support (src/model/violin.ts)
Horizontal violin box cleanup (src/model/violinBox.ts)
Autoplay fix (src/model/abstract.ts, src/service/autoplay.ts)
Layer switching (src/service/navigation.ts, src/model/plot.ts)
implement
Orientation in instructions (src/model/context.ts, src/maidr-component.tsx)
Checklist
ManualTestingProcess.md, and all tests related to this pull request pass.Additional Notes