i18n, a11y, IME · palette copy reads i18n with builtin en/zh; dialog and palette Enter run on the field's key-down action, so an IME-kept Enter never submits; Button, IconButton, TextInput, Tabs, EditorTabs, StatusBarItem and palette rows name their role and label

This commit is contained in:
ZacharyZhang-NY committed 2026-10-02 12:58:43 -04:00
1 parent 8fd7b8ab87
commit 4580e3b075
15 files changed
+257 -75

No files matched your search

+7 -13
View File
@@ -69,7 +69,7 @@ impl Dialog {
self
}
/// Runs on an unmodified Enter release while the `focus_first` field holds focus; `build` gets the dialog's close.
/// Runs on an unmodified Enter while the `focus_first` field holds focus; `build` gets the dialog's close. The field's key binding fires on key-down, so an Enter an IME takes never reaches it.
pub(crate) fn on_enter(mut self, build: impl FnOnce(Close) -> Run + 'static) -> Self {
self.enter = Some(Box::new(build));
self
@@ -254,18 +254,12 @@ impl RenderOnce for Dialog {
}
})
.when_some(enter, |layer, (field, enter)| {
layer
.capture_action(|_: &Enter, _, cx| cx.stop_propagation())
.on_key_up(move |event, window, cx| {
let stroke = &event.keystroke;
if stroke.key == "enter"
&& !stroke.modifiers.modified()
&& field.is_focused(window)
{
cx.stop_propagation();
enter(window, cx);
}
})
layer.capture_action(move |_: &Enter, window, cx| {
cx.stop_propagation();
if field.is_focused(window) {
enter(window, cx);
}
})
})
.child(
FocusScope::new(&focus)