module RatatuiRuby::Frame::A11yCapture
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.
Public Instance Methods
Source
# File lib/ratatui_ruby/labs/frame_a11y_capture.rb, line 39 def flush_a11y_capture widgets = @a11y_widgets return unless Labs.enabled?(:a11y) && widgets&.any? Labs::A11y.dump_widgets(widgets) @a11y_widgets = nil end
Called at end of draw block to flush captured widgets
Source
# File lib/ratatui_ruby/labs/frame_a11y_capture.rb, line 30 def render_stateful_widget(widget, area, state) if Labs.enabled?(:a11y) widgets = (@a11y_widgets ||= []) #: Array[[(_CustomWidget | widget), Layout::Rect]] widgets << [widget, area] end super end
Intercepts render_stateful_widget to capture widgets for A11Y export. @param widget [widget] The widget being rendered @param area [Layout::Rect] The area to render into @param state [Object] The widget state
Calls superclass method
Source
# File lib/ratatui_ruby/labs/frame_a11y_capture.rb, line 18 def render_widget(widget, area) if Labs.enabled?(:a11y) widgets = (@a11y_widgets ||= []) #: Array[[(_CustomWidget | widget), Layout::Rect]] widgets << [widget, area] end super end
Intercepts render_widget to capture widgets for A11Y export. @param widget [widget] The widget being rendered @param area [Layout::Rect] The area to render into
Calls superclass method