Module: RatatuiRuby::Frame::A11yCapture
- Included in:
- RatatuiRuby::Frame
- Defined in:
- lib/ratatui_ruby/labs/frame_a11y_capture.rb
Overview
A11Y Lab Integration
When the A11Y lab is enabled, we capture widgets as they are rendered and write the tree to XML when flush_a11y_capture is called.
Instance Method Summary collapse
-
#flush_a11y_capture ⇒ Object
Called at end of draw block to flush captured widgets.
-
#render_stateful_widget(widget, area, state) ⇒ Object
Intercepts render_stateful_widget to capture widgets for A11Y export.
-
#render_widget(widget, area) ⇒ Object
Intercepts render_widget to capture widgets for A11Y export.
Instance Method Details
#flush_a11y_capture ⇒ Object
Called at end of draw block to flush captured widgets
39 40 41 42 43 44 45 |
# File 'lib/ratatui_ruby/labs/frame_a11y_capture.rb', line 39 def flush_a11y_capture = @a11y_widgets return unless Labs.enabled?(:a11y) && &.any? Labs::A11y.() @a11y_widgets = nil end |
#render_stateful_widget(widget, area, state) ⇒ Object
Intercepts render_stateful_widget to capture widgets for A11Y export.
30 31 32 33 34 35 36 |
# File 'lib/ratatui_ruby/labs/frame_a11y_capture.rb', line 30 def (, area, state) if Labs.enabled?(:a11y) = (@a11y_widgets ||= []) #: Array[[(_CustomWidget | widget), Layout::Rect]] << [, area] end super end |
#render_widget(widget, area) ⇒ Object
Intercepts render_widget to capture widgets for A11Y export.
18 19 20 21 22 23 24 |
# File 'lib/ratatui_ruby/labs/frame_a11y_capture.rb', line 18 def (, area) if Labs.enabled?(:a11y) = (@a11y_widgets ||= []) #: Array[[(_CustomWidget | widget), Layout::Rect]] << [, area] end super end |