accessibility-plugin-react 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.mts +70 -1
- package/dist/index.d.ts +70 -1
- package/dist/index.js +684 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +684 -44
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +309 -0
- package/docs/API.md +3 -3
- package/docs/BUILD_AND_RELEASE_PLAN.md +1 -1
- package/docs/FEATURES.md +1 -0
- package/docs/READING_MODE.md +128 -0
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -1545,3 +1545,312 @@
|
|
|
1545
1545
|
background: var(--arap-selected, #eff6ff);
|
|
1546
1546
|
color: var(--arap-text, #0f172a);
|
|
1547
1547
|
}
|
|
1548
|
+
|
|
1549
|
+
/* Reading Mode Overlay & Dialog (A11Y-307) */
|
|
1550
|
+
.arap-reading-mode-backdrop {
|
|
1551
|
+
position: fixed;
|
|
1552
|
+
inset: 0;
|
|
1553
|
+
z-index: 2147483646;
|
|
1554
|
+
overflow-y: auto;
|
|
1555
|
+
display: flex;
|
|
1556
|
+
justify-content: center;
|
|
1557
|
+
align-items: flex-start;
|
|
1558
|
+
padding: 24px 16px;
|
|
1559
|
+
background: rgba(15, 23, 42, 0.45);
|
|
1560
|
+
backdrop-filter: blur(4px);
|
|
1561
|
+
-webkit-backdrop-filter: blur(4px);
|
|
1562
|
+
box-sizing: border-box;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
.arap-reading-mode-backdrop[data-theme="sepia"] {
|
|
1566
|
+
background: rgba(68, 51, 34, 0.45);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
.arap-reading-mode-backdrop[data-theme="dark"] {
|
|
1570
|
+
background: rgba(0, 0, 0, 0.75);
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
.arap-reading-mode-dialog {
|
|
1574
|
+
position: relative;
|
|
1575
|
+
width: 100%;
|
|
1576
|
+
max-width: 760px;
|
|
1577
|
+
min-height: 50vh;
|
|
1578
|
+
margin: 16px auto;
|
|
1579
|
+
border-radius: 12px;
|
|
1580
|
+
box-shadow:
|
|
1581
|
+
0 20px 25px -5px rgba(0, 0, 0, 0.15),
|
|
1582
|
+
0 10px 10px -5px rgba(0, 0, 0, 0.05);
|
|
1583
|
+
display: flex;
|
|
1584
|
+
flex-direction: column;
|
|
1585
|
+
outline: none;
|
|
1586
|
+
box-sizing: border-box;
|
|
1587
|
+
font-family:
|
|
1588
|
+
system-ui,
|
|
1589
|
+
-apple-system,
|
|
1590
|
+
BlinkMacSystemFont,
|
|
1591
|
+
"Segoe UI",
|
|
1592
|
+
Roboto,
|
|
1593
|
+
"Noto Sans Sinhala",
|
|
1594
|
+
"Noto Sans Tamil",
|
|
1595
|
+
sans-serif;
|
|
1596
|
+
transition:
|
|
1597
|
+
background-color 0.2s ease,
|
|
1598
|
+
color 0.2s ease;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
/* Theme color schemes */
|
|
1602
|
+
.arap-reading-mode-backdrop[data-theme="light"] .arap-reading-mode-dialog {
|
|
1603
|
+
background: #ffffff;
|
|
1604
|
+
color: #1e293b;
|
|
1605
|
+
border: 1px solid #e2e8f0;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.arap-reading-mode-backdrop[data-theme="sepia"] .arap-reading-mode-dialog {
|
|
1609
|
+
background: #fbf0d9;
|
|
1610
|
+
color: #5f4b32;
|
|
1611
|
+
border: 1px solid #ebd5b3;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
.arap-reading-mode-backdrop[data-theme="dark"] .arap-reading-mode-dialog {
|
|
1615
|
+
background: #18181b;
|
|
1616
|
+
color: #f4f4f5;
|
|
1617
|
+
border: 1px solid #27272a;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.arap-reading-mode-header {
|
|
1621
|
+
display: flex;
|
|
1622
|
+
justify-content: space-between;
|
|
1623
|
+
align-items: center;
|
|
1624
|
+
flex-wrap: wrap;
|
|
1625
|
+
gap: 12px;
|
|
1626
|
+
padding: 16px 24px;
|
|
1627
|
+
border-bottom: 1px solid rgba(148, 163, 184, 0.2);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
.arap-reading-mode-meta {
|
|
1631
|
+
display: flex;
|
|
1632
|
+
align-items: center;
|
|
1633
|
+
gap: 8px;
|
|
1634
|
+
font-size: 0.875rem;
|
|
1635
|
+
opacity: 0.85;
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
.arap-reading-mode-badge {
|
|
1639
|
+
font-weight: 600;
|
|
1640
|
+
text-transform: uppercase;
|
|
1641
|
+
font-size: 0.75rem;
|
|
1642
|
+
letter-spacing: 0.05em;
|
|
1643
|
+
padding: 2px 8px;
|
|
1644
|
+
border-radius: 4px;
|
|
1645
|
+
background: rgba(148, 163, 184, 0.15);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
.arap-reading-mode-toolbar {
|
|
1649
|
+
display: flex;
|
|
1650
|
+
align-items: center;
|
|
1651
|
+
gap: 12px;
|
|
1652
|
+
}
|
|
1653
|
+
|
|
1654
|
+
.arap-reading-mode-theme-group,
|
|
1655
|
+
.arap-reading-mode-zoom-group {
|
|
1656
|
+
display: inline-flex;
|
|
1657
|
+
border-radius: 6px;
|
|
1658
|
+
border: 1px solid rgba(148, 163, 184, 0.25);
|
|
1659
|
+
overflow: hidden;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
.arap-reader-theme-btn,
|
|
1663
|
+
.arap-reader-zoom-btn {
|
|
1664
|
+
min-height: 36px;
|
|
1665
|
+
min-width: 44px;
|
|
1666
|
+
padding: 4px 10px;
|
|
1667
|
+
border: none;
|
|
1668
|
+
background: transparent;
|
|
1669
|
+
color: inherit;
|
|
1670
|
+
font-size: 0.8125rem;
|
|
1671
|
+
font-weight: 500;
|
|
1672
|
+
cursor: pointer;
|
|
1673
|
+
transition: background-color 0.15s ease;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
.arap-reader-theme-btn:not(:last-child),
|
|
1677
|
+
.arap-reader-zoom-btn:not(:last-child) {
|
|
1678
|
+
border-right: 1px solid rgba(148, 163, 184, 0.25);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
.arap-reader-theme-btn.arap-active {
|
|
1682
|
+
background: rgba(148, 163, 184, 0.25);
|
|
1683
|
+
font-weight: 600;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
.arap-reader-zoom-btn:disabled {
|
|
1687
|
+
opacity: 0.4;
|
|
1688
|
+
cursor: not-allowed;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
.arap-reading-mode-close {
|
|
1692
|
+
min-width: 44px;
|
|
1693
|
+
min-height: 44px;
|
|
1694
|
+
display: inline-flex;
|
|
1695
|
+
align-items: center;
|
|
1696
|
+
justify-content: center;
|
|
1697
|
+
background: transparent;
|
|
1698
|
+
border: none;
|
|
1699
|
+
font-size: 1.5rem;
|
|
1700
|
+
line-height: 1;
|
|
1701
|
+
color: inherit;
|
|
1702
|
+
cursor: pointer;
|
|
1703
|
+
border-radius: 6px;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
.arap-reading-mode-close:hover,
|
|
1707
|
+
.arap-reader-theme-btn:hover:not(:disabled),
|
|
1708
|
+
.arap-reader-zoom-btn:hover:not(:disabled) {
|
|
1709
|
+
background: rgba(148, 163, 184, 0.15);
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
.arap-reading-mode-content {
|
|
1713
|
+
padding: 32px 36px;
|
|
1714
|
+
flex: 1 1 auto;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
.arap-reading-mode-title {
|
|
1718
|
+
margin: 0 0 12px 0;
|
|
1719
|
+
font-size: 2.125rem;
|
|
1720
|
+
line-height: 1.25;
|
|
1721
|
+
font-weight: 700;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
.arap-reading-mode-byline {
|
|
1725
|
+
margin: 0 0 24px 0;
|
|
1726
|
+
font-size: 0.9375rem;
|
|
1727
|
+
opacity: 0.75;
|
|
1728
|
+
font-style: italic;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
.arap-reading-mode-body {
|
|
1732
|
+
line-height: 1.8;
|
|
1733
|
+
font-size: 1.0625rem;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
.arap-reading-mode-body p {
|
|
1737
|
+
margin: 0 0 1.5em 0;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
.arap-reading-mode-body h2 {
|
|
1741
|
+
font-size: 1.5rem;
|
|
1742
|
+
margin: 1.75em 0 0.75em 0;
|
|
1743
|
+
font-weight: 600;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
.arap-reading-mode-body h3 {
|
|
1747
|
+
font-size: 1.25rem;
|
|
1748
|
+
margin: 1.5em 0 0.5em 0;
|
|
1749
|
+
font-weight: 600;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
.arap-reading-mode-body ul,
|
|
1753
|
+
.arap-reading-mode-body ol {
|
|
1754
|
+
margin: 0 0 1.5em 0;
|
|
1755
|
+
padding-left: 1.75em;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
.arap-reading-mode-body li {
|
|
1759
|
+
margin-bottom: 0.5em;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
.arap-reading-mode-body a {
|
|
1763
|
+
color: #0284c7;
|
|
1764
|
+
text-decoration: underline;
|
|
1765
|
+
text-underline-offset: 3px;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
.arap-reading-mode-backdrop[data-theme="dark"] .arap-reading-mode-body a {
|
|
1769
|
+
color: #38bdf8;
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
.arap-reading-mode-backdrop[data-theme="sepia"] .arap-reading-mode-body a {
|
|
1773
|
+
color: #8c5b00;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
.arap-reading-mode-body img {
|
|
1777
|
+
max-width: 100%;
|
|
1778
|
+
height: auto;
|
|
1779
|
+
border-radius: 8px;
|
|
1780
|
+
margin: 1.5em 0;
|
|
1781
|
+
display: block;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
.arap-reading-mode-body figure {
|
|
1785
|
+
margin: 1.5em 0;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
.arap-reading-mode-body figcaption {
|
|
1789
|
+
font-size: 0.875rem;
|
|
1790
|
+
opacity: 0.75;
|
|
1791
|
+
text-align: center;
|
|
1792
|
+
margin-top: 6px;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
.arap-reading-mode-body blockquote {
|
|
1796
|
+
margin: 1.5em 0;
|
|
1797
|
+
padding: 12px 20px;
|
|
1798
|
+
border-left: 4px solid currentColor;
|
|
1799
|
+
opacity: 0.9;
|
|
1800
|
+
font-style: italic;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
.arap-reading-mode-body pre {
|
|
1804
|
+
margin: 1.5em 0;
|
|
1805
|
+
padding: 16px;
|
|
1806
|
+
border-radius: 8px;
|
|
1807
|
+
background: rgba(148, 163, 184, 0.15);
|
|
1808
|
+
overflow-x: auto;
|
|
1809
|
+
font-size: 0.9rem;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
.arap-reading-mode-body code {
|
|
1813
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
.arap-reading-mode-footer {
|
|
1817
|
+
padding: 16px 24px;
|
|
1818
|
+
border-top: 1px solid rgba(148, 163, 184, 0.2);
|
|
1819
|
+
display: flex;
|
|
1820
|
+
justify-content: center;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.arap-reading-mode-exit-btn {
|
|
1824
|
+
min-height: 44px;
|
|
1825
|
+
padding: 8px 24px;
|
|
1826
|
+
border-radius: 6px;
|
|
1827
|
+
border: 1px solid rgba(148, 163, 184, 0.35);
|
|
1828
|
+
background: transparent;
|
|
1829
|
+
color: inherit;
|
|
1830
|
+
font-size: 0.9375rem;
|
|
1831
|
+
font-weight: 500;
|
|
1832
|
+
cursor: pointer;
|
|
1833
|
+
transition: background-color 0.15s ease;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
.arap-reading-mode-exit-btn:hover {
|
|
1837
|
+
background: rgba(148, 163, 184, 0.15);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
@media (max-width: 640px) {
|
|
1841
|
+
.arap-reading-mode-backdrop {
|
|
1842
|
+
padding: 0;
|
|
1843
|
+
}
|
|
1844
|
+
.arap-reading-mode-dialog {
|
|
1845
|
+
margin: 0;
|
|
1846
|
+
min-height: 100vh;
|
|
1847
|
+
border-radius: 0;
|
|
1848
|
+
border: none;
|
|
1849
|
+
}
|
|
1850
|
+
.arap-reading-mode-content {
|
|
1851
|
+
padding: 20px 16px;
|
|
1852
|
+
}
|
|
1853
|
+
.arap-reading-mode-title {
|
|
1854
|
+
font-size: 1.75rem;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
package/docs/API.md
CHANGED
|
@@ -51,11 +51,11 @@ Definitions/defaults are immutable for the provider lifetime; the first register
|
|
|
51
51
|
|
|
52
52
|
`FeatureRegistration` is `FeatureOptions<unknown>` plus `defaultValue: unknown`. Use the generic hook instead of manually casting callbacks. Legacy `registerReset(key, fn)` / `unregisterReset(key)` remain available; callbacks run before global state is cleared. They are not the primary effect lifecycle API. Callback owners must unregister their callback on teardown.
|
|
53
53
|
|
|
54
|
-
Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`, `ToggleControlProps`, `ChoiceControlProps`, `ChoiceOption<T>`, `ChoiceGroup<T>`, `StepperControlProps`, `FeatureCardProps`, `FeatureStatus`, `SearchCountProps`, `EmptyStateProps`, `ErrorStateProps`, `ProfilePreviewCardProps`, `FontSizeControllerProps`, `TextScaleControllerProps`, `TextScaleStep`, `FontFamilyPreset`, `ContrastModeValue`, `ContrastPalette`, `LineHeightControllerProps`, `LetterSpacingControllerProps`, `WordSpacingControllerProps`, `ParagraphSpacingControllerProps`, `ScriptSpacingConstraints`, `SkipToMainLinkProps`, `HideImagesControllerProps`, `BigCursorControllerProps`, `ReadingMaskControllerProps`, `ReadingGuideControllerProps`, `TooltipsControllerProps`, `PageNavigatorControllerProps`, `HeadingItem`, `LandmarkItem`, `ProfilesControllerProps`, `ActiveProfileState`, `UseProfilesResult`, `AccessibilityPreferences`, `ContrastMode`, `CursorSizePreference`, `FontFamilyPreference`, `ProfileDefinition`, `ProfilePresetId`, `ReaderMode`, `SaturationPreference`, `StorageMode`, `TextAlignPreference`, `LocaleStrings`, `SupportedLocale`, `FeatureLocaleLabels`, `PresetsControllerProps`, `CustomPreset`, `PresetsExportV1`, `ImportResult`, `UsePresetsResult`.
|
|
54
|
+
Exported types: `AccessibilityPluginProps`, `AccessibilityButtonProps`, `AccessibilityListProps`, `AccessibilityState`, `AccessibilityContextValue`, `PluginPosition`, `WidgetPlacement`, `FeatureOptions<T>`, `FeatureRegistration`, `ToggleControlProps`, `ChoiceControlProps`, `ChoiceOption<T>`, `ChoiceGroup<T>`, `StepperControlProps`, `FeatureCardProps`, `FeatureStatus`, `SearchCountProps`, `EmptyStateProps`, `ErrorStateProps`, `ProfilePreviewCardProps`, `FontSizeControllerProps`, `TextScaleControllerProps`, `TextScaleStep`, `FontFamilyPreset`, `ContrastModeValue`, `ContrastPalette`, `LineHeightControllerProps`, `LetterSpacingControllerProps`, `WordSpacingControllerProps`, `ParagraphSpacingControllerProps`, `ScriptSpacingConstraints`, `SkipToMainLinkProps`, `HideImagesControllerProps`, `BigCursorControllerProps`, `ReadingMaskControllerProps`, `ReadingGuideControllerProps`, `TooltipsControllerProps`, `PageNavigatorControllerProps`, `HeadingItem`, `LandmarkItem`, `ProfilesControllerProps`, `ActiveProfileState`, `UseProfilesResult`, `AccessibilityPreferences`, `ContrastMode`, `CursorSizePreference`, `FontFamilyPreference`, `ProfileDefinition`, `ProfilePresetId`, `ReaderMode`, `SaturationPreference`, `StorageMode`, `TextAlignPreference`, `LocaleStrings`, `SupportedLocale`, `FeatureLocaleLabels`, `PresetsControllerProps`, `CustomPreset`, `PresetsExportV1`, `ImportResult`, `UsePresetsResult`, `ReadingModeControllerProps`, `ArticleContent`.
|
|
55
55
|
|
|
56
|
-
Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `ReduceMotionController`, `HideImagesController`, `HideDecorativeImagesController`, `BigCursorController`, `ReadingMaskController`, `ReadingGuideController`, `TooltipsController`, `AccessibleTooltipsController`, `PageNavigatorController`, `HeadingsNavigatorController`, `PageStructureController`, `ProfilesController`, `ProfileController`, `AccessibilityProfilesController`, `PresetsController`, `CustomPresetsController`, `SettingsImportExportController`, `PresetsBackupController`, `SkipToMainLink`.
|
|
56
|
+
Exported control components: `ToggleControl`, `ChoiceControl`, `StepperControl`, `FeatureCard`, `SearchCount`, `EmptyState`, `ErrorState`, `ProfilePreviewCard`, `FontSizeController`, `TextScaleController`, `LineHeightController`, `LetterSpacingController`, `WordSpacingController`, `ParagraphSpacingController`, `FontFamilyController`, `TextAlignController`, `ContrastController`, `ContrastModeController`, `LinkHighlightController`, `HighlightFocusController`, `FocusHighlightController`, `ReduceMotionController`, `HideImagesController`, `HideDecorativeImagesController`, `BigCursorController`, `ReadingMaskController`, `ReadingGuideController`, `TooltipsController`, `AccessibleTooltipsController`, `PageNavigatorController`, `HeadingsNavigatorController`, `PageStructureController`, `ProfilesController`, `ProfileController`, `AccessibilityProfilesController`, `PresetsController`, `CustomPresetsController`, `SettingsImportExportController`, `PresetsBackupController`, `ReadingModeController`, `SkipToMainLink`.
|
|
57
57
|
|
|
58
|
-
Exported typography, contrast, reading aids, tooltips, and reflow utilities: `TEXT_SCALE_STEPS`, `TEXT_SCALE_PROTECTED_SELECTOR`, `isProtectedFromTextScale`, `LINE_HEIGHT_STEPS`, `LINE_HEIGHT_RATIOS`, `TEXT_SPACING_EXCLUDED_SELECTOR`, `isProtectedFromTextSpacing`, `getScriptSpacingConstraints`, `FONT_FAMILY_PRESETS`, `LEGIBLE_FONT_STACK`, `DYSLEXIA_FONT_STACK`, `FONT_FAMILY_PROTECTED_SELECTOR`, `isProtectedFromFontFamily`, `TEXT_ALIGN_BLOCK_SELECTOR`, `isProtectedFromTextAlign`, `CONTRAST_MODES`, `isForcedColorsActive`, `subscribeForcedColors`, `isReducedMotionActive`, `subscribeReducedMotion`, `isEligibleDecorativeImage`, `isFunctionalOrMeaningfulImage`, `hasFinePointer`, `subscribeFinePointer`, `nudgeReadingAid`, `DEFAULT_READING_MASK_HEIGHT`, `MIN_READING_MASK_HEIGHT`, `MAX_READING_MASK_HEIGHT`, `READING_MASK_HEIGHT_PRESETS`, `getAuthoredDescription`, `positionTooltip`, `enableAccessibleTooltips`, `scanHeadings`, `scanLandmarks`, `navigateToElement`, `subscribePageStructure`, `useProfiles`, `ALL_PROFILE_IDS`, `getProfileDefinition`, `mapProfileSettingsToFeatures`, `mapFeaturesToProfileSettings`, `applyProfileToStore`, `revertProfileFromStore`, `recordProfileOverride`, `usePresets`, `createCustomPreset`, `isValidCustomPreset`, `exportPresetsToJson`, `downloadJsonFile`, `validateAndParseImport`, `applyCustomPresetToStore`, `sanitizePreferences`, `ALLOWED_PREFERENCE_KEYS`, `CONTRAST_PROTECTED_SELECTOR`, `isProtectedFromContrast`, `CONTRAST_PALETTES`, `findMainLandmark`.
|
|
58
|
+
Exported typography, contrast, reading aids, tooltips, reading mode, and reflow utilities: `TEXT_SCALE_STEPS`, `TEXT_SCALE_PROTECTED_SELECTOR`, `isProtectedFromTextScale`, `LINE_HEIGHT_STEPS`, `LINE_HEIGHT_RATIOS`, `TEXT_SPACING_EXCLUDED_SELECTOR`, `isProtectedFromTextSpacing`, `getScriptSpacingConstraints`, `FONT_FAMILY_PRESETS`, `LEGIBLE_FONT_STACK`, `DYSLEXIA_FONT_STACK`, `FONT_FAMILY_PROTECTED_SELECTOR`, `isProtectedFromFontFamily`, `TEXT_ALIGN_BLOCK_SELECTOR`, `isProtectedFromTextAlign`, `CONTRAST_MODES`, `isForcedColorsActive`, `subscribeForcedColors`, `isReducedMotionActive`, `subscribeReducedMotion`, `isEligibleDecorativeImage`, `isFunctionalOrMeaningfulImage`, `hasFinePointer`, `subscribeFinePointer`, `nudgeReadingAid`, `DEFAULT_READING_MASK_HEIGHT`, `MIN_READING_MASK_HEIGHT`, `MAX_READING_MASK_HEIGHT`, `READING_MASK_HEIGHT_PRESETS`, `getAuthoredDescription`, `positionTooltip`, `enableAccessibleTooltips`, `scanHeadings`, `scanLandmarks`, `navigateToElement`, `subscribePageStructure`, `useProfiles`, `ALL_PROFILE_IDS`, `getProfileDefinition`, `mapProfileSettingsToFeatures`, `mapFeaturesToProfileSettings`, `applyProfileToStore`, `revertProfileFromStore`, `recordProfileOverride`, `usePresets`, `createCustomPreset`, `isValidCustomPreset`, `exportPresetsToJson`, `downloadJsonFile`, `validateAndParseImport`, `applyCustomPresetToStore`, `sanitizePreferences`, `ALLOWED_PREFERENCE_KEYS`, `extractArticleContent`, `findArticleCandidate`, `countWords`, `estimateReadingTime`, `CONTRAST_PROTECTED_SELECTOR`, `isProtectedFromContrast`, `CONTRAST_PALETTES`, `findMainLandmark`.
|
|
59
59
|
|
|
60
60
|
Exported preference and profile utilities: `DEFAULT_PREFERENCES`, `PROFILE_DEFINITIONS`, `normalizePreferences`, `normalizePreferenceValue`, `resolveEffectivePreferences`, `preferencesReducer`, `createInitialPreferencesState`.
|
|
61
61
|
|
|
@@ -99,7 +99,7 @@ completed. Closing a child issue does not replace the milestone exit review.
|
|
|
99
99
|
- [x] [A11Y-304 — Eight profiles and deterministic override model #52](https://github.com/prabothcharith/accessibility-react/issues/52) — Implement eight neutral editable profiles with previews, atomic application, explicit override layering and no implicit speech or microphone activation.
|
|
100
100
|
- [x] [A11Y-305 — Custom saved presets and settings import/export #53](https://github.com/prabothcharith/accessibility-react/issues/53) — Add named custom presets and validated versioned JSON import/export that excludes personal content and handles malformed data clearly.
|
|
101
101
|
- [x] [A11Y-306 — Sinhala and Tamil locale packs with accessibility review #54](https://github.com/prabothcharith/accessibility-react/issues/54) — Add reviewed Sinhala and Tamil widget locale packs and verify glyphs, long labels, search, announcements, fallback and assistive use.
|
|
102
|
-
- [
|
|
102
|
+
- [x] [A11Y-307 — Non-destructive reading mode proof of concept #55](https://github.com/prabothcharith/accessibility-react/issues/55) — Prototype safe article-focused reading mode without rewriting host DOM, losing content, breaking focus or sending content externally.
|
|
103
103
|
- [ ] [A11Y-308 — Keyboard shortcut help, remapping and link explorer #56](https://github.com/prabothcharith/accessibility-react/issues/56) — Add discoverable shortcut and heading-navigation help, collision-safe remapping and link exploration without hijacking browser or host commands.
|
|
104
104
|
|
|
105
105
|
### M4 — Advanced and experimental controls
|
package/docs/FEATURES.md
CHANGED
|
@@ -31,6 +31,7 @@ All features are opt-in via controllers, use native buttons, support Enter/Space
|
|
|
31
31
|
| ProfilesController / ProfileController / AccessibilityProfilesController | activeProfile; ProfilePresetId / null | Previews, applies, and reverts eight neutral presets (Motor, Blind, Color Blind, Dyslexia, Low Vision, Cognitive, Seizure, ADHD). Follows deterministic override model where user explicit choices survive reversal. Zero implicit audio/mic. See docs/PROFILES.md. |
|
|
32
32
|
| PresetsController / CustomPresetsController / SettingsImportExportController | customPresets; CustomPreset[] | Saves named user presets, 1-click apply/delete, and versioned JSON backup and transfer. Strict privacy exclusions discard private data, transcripts, and credentials. Saved presets library survives display reset. See docs/PRESETS.md. |
|
|
33
33
|
| Locales & i18n (`en`, `si`, `si-LK`, `ta`, `ta-LK`) | LocaleStrings / `locale` prop | Reviewed English, Sinhala, and Tamil locale packs with typography fallbacks and full RTL infrastructure. Automatic `document.documentElement.lang` resolution; host content is never translated. See docs/LOCALES.md. |
|
|
34
|
+
| ReadingModeController / readingMode | false; boolean | Non-destructive article extraction into an accessible overlay dialog. Preserves headings, links, images, and alt text while stripping forms, navigation, and sensitive fields. Supports Light/Sepia/Dark themes and zoom. See docs/READING_MODE.md. |
|
|
34
35
|
| ResetController | No feature state | Clears display settings including custom/unmounted controls, preserves widget placement; runs legacy reset callbacks; keeps panel open. |
|
|
35
36
|
|
|
36
37
|
## Accessible control primitives and UI states
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Non-Destructive Reading Mode (`ReadingModeController`)
|
|
2
|
+
|
|
3
|
+
The **Reading Mode** feature (`ReadingModeController`, key `readingMode`) provides a distraction-free, high-readability article view that extracts long-form text and media into an accessible reading modal without rewriting or unmounting the host application's React DOM tree.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Architecture and Core Principles
|
|
8
|
+
|
|
9
|
+
### 1. Strictly Non-Destructive Extraction
|
|
10
|
+
|
|
11
|
+
Traditional browser reader modes or third-party bookmarklets often replace or mutate the underlying document body, destroying client-side React component trees, losing form input state, breaking single-page application (SPA) routing, and detaching event listeners.
|
|
12
|
+
|
|
13
|
+
The `accessibility-plugin-react` implementation is **100% non-destructive**:
|
|
14
|
+
|
|
15
|
+
- The article extractor clones the candidate content element (`node.cloneNode(true)`) in memory.
|
|
16
|
+
- The original host DOM tree is **never rewritten, detached, or mutated**.
|
|
17
|
+
- Interactive host elements (such as counters, search fields, or form inputs) retain their exact state, event listeners, and focus history before, during, and after a reading session.
|
|
18
|
+
|
|
19
|
+
### 2. Client-Side Confidentiality (Zero External Network Requests)
|
|
20
|
+
|
|
21
|
+
- Extraction, scoring, sanitization, and rendering execute purely in memory in the user's browser.
|
|
22
|
+
- **No external APIs, cloud extractors, or third-party web services** are contacted.
|
|
23
|
+
- Verified in automated test suites: zero calls to `fetch`, `XMLHttpRequest`, or `navigator.sendBeacon`.
|
|
24
|
+
|
|
25
|
+
### 3. Sensitive Field and Non-Article Stripping
|
|
26
|
+
|
|
27
|
+
Even when articles contain nested widgets or forms, the extractor strictly sanitizes all disallowed and sensitive markup:
|
|
28
|
+
|
|
29
|
+
- **Sensitive inputs**: Password fields (`input[type="password"]`), credit card inputs (`[autocomplete*="cc-"]`), CSRF/hidden tokens, and sensitive data attributes (`[data-sensitive]`) are stripped completely.
|
|
30
|
+
- **Forms and interactive inputs**: `<form>`, `<input>`, `<select>`, `<textarea>`, and `<button>` elements are removed to prevent state ambiguity.
|
|
31
|
+
- **Boilerplate and navigation**: `<nav>`, `<header>`, `<footer>`, `<aside>`, modals/dialogs, cookie banners, advertisements, and social share widgets are filtered out.
|
|
32
|
+
- **Dangerous code and handlers**: `<script>`, `<iframe>`, `<object>`, `<embed>`, inline event handlers (`onclick`, etc.), and unsafe URL protocols (`javascript:`, `vbscript:`) are sanitized.
|
|
33
|
+
|
|
34
|
+
### 4. Preservation of Semantic Structure
|
|
35
|
+
|
|
36
|
+
The extractor preserves meaningful article semantics:
|
|
37
|
+
|
|
38
|
+
- **Headings**: `h1` through `h6` retaining clear hierarchy.
|
|
39
|
+
- **Typography & Flow**: `p`, `blockquote`, `pre`, `code`, `time`, and emphasis (`strong`, `em`, `mark`).
|
|
40
|
+
- **Lists & Tables**: `ul`, `ol`, `li`, `table`, `thead`, `tbody`, `tr`, `th`, `td`.
|
|
41
|
+
- **Hyperlinks**: `a[href]` with safe URLs (`https://`, relative paths, anchor fragments), decorated with `target="_blank"` and `rel="noopener noreferrer"`.
|
|
42
|
+
- **Images and Media**: `img[src]` preserving `alt` text and dimensions, together with `<figure>` and `<figcaption>` captions.
|
|
43
|
+
|
|
44
|
+
### 5. Honest Fallback and Failure Recovery
|
|
45
|
+
|
|
46
|
+
If a page lacks substantive readable content (e.g. an authentication screen, an empty dashboard, or a navigation-only hub):
|
|
47
|
+
|
|
48
|
+
- Extraction gracefully fails without throwing an unhandled exception or trapping the user in a blank view.
|
|
49
|
+
- The toggle state automatically reverts to `false`.
|
|
50
|
+
- A polite status announcement is communicated to assistive technology:
|
|
51
|
+
- English: _"No readable article content found on this page."_
|
|
52
|
+
- Sinhala: _"මෙම පිටුවෙහි කියවිය හැකි ලිපි අන්තර්ගතයක් හමු නොවීය."_
|
|
53
|
+
- Tamil: _"இப்பக்கத்தில் படிக்கக்கூடிய கட்டுரை உள்ளடக்கம் எதுவும் இல்லை."_
|
|
54
|
+
- Focus safely returns to the triggering control.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## User Experience and Controls
|
|
59
|
+
|
|
60
|
+
When reading mode is opened, it renders an accessible overlay dialog (`role="dialog"`, `aria-modal="true"`):
|
|
61
|
+
|
|
62
|
+
1. **Toolbar Header**:
|
|
63
|
+
- **Article Meta**: Displays word count and estimated reading time (standard 200 words-per-minute baseline).
|
|
64
|
+
- **Theme Switcher**: Quick toggle between **Light**, **Sepia** (reduced blue light), and **Dark** modes.
|
|
65
|
+
- **Text Scaling**: Incremental zoom steppers (`A-` and `A+`) allowing text scaling between 90% and 160%.
|
|
66
|
+
- **Close Button**: Accessible `×` button with minimum 44×44px touch targets.
|
|
67
|
+
2. **Focus Management & Keyboard Accessibility**:
|
|
68
|
+
- Focus is automatically placed inside the dialog when opened.
|
|
69
|
+
- Focus is trapped within interactive controls inside the dialog during the reading session (`Tab` / `Shift+Tab`).
|
|
70
|
+
- Pressing `Escape` immediately dismisses the reader view and restores focus to the invoking launcher/toggle button.
|
|
71
|
+
- Footer contains an explicit "Close Reading Mode" button for touch and keyboard users.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Component Usage
|
|
76
|
+
|
|
77
|
+
### Basic Compound Integration
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import {
|
|
81
|
+
AccessibilityPlugin,
|
|
82
|
+
AccessibilityButton,
|
|
83
|
+
AccessibilityList,
|
|
84
|
+
ReadingModeController,
|
|
85
|
+
} from "accessibility-plugin-react";
|
|
86
|
+
import "accessibility-plugin-react/styles.css";
|
|
87
|
+
|
|
88
|
+
export function App() {
|
|
89
|
+
return (
|
|
90
|
+
<AccessibilityPlugin>
|
|
91
|
+
<AccessibilityButton />
|
|
92
|
+
<AccessibilityList>
|
|
93
|
+
<ReadingModeController />
|
|
94
|
+
</AccessibilityList>
|
|
95
|
+
</AccessibilityPlugin>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Standalone Extractor Utility
|
|
101
|
+
|
|
102
|
+
For headless or custom reader implementations, the core extractor function is exported directly:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { extractArticleContent } from "accessibility-plugin-react";
|
|
106
|
+
|
|
107
|
+
const article = extractArticleContent(document.body);
|
|
108
|
+
if (article) {
|
|
109
|
+
console.log(`Title: ${article.title}`);
|
|
110
|
+
console.log(
|
|
111
|
+
`Words: ${article.wordCount} (~${article.readingTimeMinutes} min)`,
|
|
112
|
+
);
|
|
113
|
+
console.log(`Sanitized HTML: ${article.html}`);
|
|
114
|
+
} else {
|
|
115
|
+
console.log("No readable article content found on this page.");
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Technical Specifications & Verification
|
|
122
|
+
|
|
123
|
+
- **Feature Key**: `readingMode` (Boolean, default: `false`).
|
|
124
|
+
- **Storage Compatibility**: Fully integrated with preference storage modes (`local`, `session`, `none`) and cleanly reset via `resetAll()`.
|
|
125
|
+
- **Test Matrix**:
|
|
126
|
+
- `tests/readingMode.test.ts`: Candidate scoring, sensitive field exclusion, protocol sanitization, image alt preservation, and offline execution.
|
|
127
|
+
- `tests/readingModeWidget.test.tsx`: Modal lifecycle, theme switching, Escape key dismissal, host React state persistence across open/close, and Sinhala/Tamil localization.
|
|
128
|
+
- `tests/browser/widget.spec.ts`: Playwright browser smoke test for live extraction, DOM isolation, theme switching, and host button interactivity.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accessibility-plugin-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "A composable React display-preference widget with a clean light design, persistent settings and movable accessible controls.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|