Move focus based on arrow key direction, using `focus_left/right/up/down` overrides.
(&mut self, direction: ArrowDirection)
| 6870 | |
| 6871 | /// Move focus based on arrow key direction, using `focus_left/right/up/down` overrides. |
| 6872 | pub fn arrow_focus(&mut self, direction: ArrowDirection) { |
| 6873 | if self.focused_element_id == 0 { |
| 6874 | return; |
| 6875 | } |
| 6876 | self.focus_from_keyboard = true; |
| 6877 | if let Some(config) = self.accessibility_configs.get(&self.focused_element_id) { |
| 6878 | let target = match direction { |
| 6879 | ArrowDirection::Left => config.focus_left, |
| 6880 | ArrowDirection::Right => config.focus_right, |
| 6881 | ArrowDirection::Up => config.focus_up, |
| 6882 | ArrowDirection::Down => config.focus_down, |
| 6883 | }; |
| 6884 | if let Some(target_id) = target { |
| 6885 | self.change_focus(target_id); |
| 6886 | } |
| 6887 | } |
| 6888 | } |
| 6889 | |
| 6890 | /// Handle keyboard activation (Enter/Space) on the focused element. |
| 6891 | pub fn handle_keyboard_activation(&mut self, pressed: bool, released: bool) { |