Skip to content

Commit

Permalink
Request accessibility update when checkbox state changes (#577)
Browse files Browse the repository at this point in the history
Fixes #576

Can someone who's more familiar with Masonry please confirm that I'm
doing this the right way? I assume that one is supposed to call
request_accessibility update along with request_paint whenever the
change to the widget state could affect accessibility.
  • Loading branch information
mwcampbell authored Sep 5, 2024
1 parent 7be4dd2 commit 786ab63
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions masonry/src/widget/checkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl WidgetMut<'_, Checkbox> {
pub fn set_checked(&mut self, checked: bool) {
self.widget.checked = checked;
self.ctx.request_paint();
self.ctx.request_accessibility_update();
}

/// Set the text.
Expand Down Expand Up @@ -76,6 +77,7 @@ impl Widget for Checkbox {
if ctx.is_active() && ctx.is_hot() && !ctx.is_disabled() {
self.checked = !self.checked;
ctx.submit_action(Action::CheckboxChecked(self.checked));
ctx.request_accessibility_update();
trace!("Checkbox {:?} released", ctx.widget_id());
}
ctx.request_paint();
Expand All @@ -94,6 +96,7 @@ impl Widget for Checkbox {
self.checked = !self.checked;
ctx.submit_action(Action::CheckboxChecked(self.checked));
ctx.request_paint();
ctx.request_accessibility_update();
}
_ => {}
}
Expand Down

0 comments on commit 786ab63

Please sign in to comment.