gpui: Press enter, space to trigger click to focused element (#35075)
Release Notes: - N/A > Any user interaction that is equivalent to a click, such as pressing the Space key or Enter key while the element is focused. Note that this only applies to elements with a default key event handler, and therefore, excludes other elements that have been made focusable by setting the [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex) attribute. https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event --------- Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com> Co-authored-by: Umesh Yadav <23421535+imumesh18@users.noreply.github.com>
This commit is contained in:
co-authored by
Anthony
Mikayla Maki
Umesh Yadav
parent
b7469f5bc3
commit
0025019db4
@@ -1,7 +1,8 @@
|
||||
use documented::Documented;
|
||||
use gpui::{
|
||||
AnyElement, AnyView, ClickEvent, CursorStyle, DefiniteLength, Hsla, MouseButton,
|
||||
MouseDownEvent, MouseUpEvent, Rems, StyleRefinement, relative, transparent_black,
|
||||
MouseClickEvent, MouseDownEvent, MouseUpEvent, Rems, StyleRefinement, relative,
|
||||
transparent_black,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@@ -620,7 +621,7 @@ impl RenderOnce for ButtonLike {
|
||||
MouseButton::Right,
|
||||
move |event, window, cx| {
|
||||
cx.stop_propagation();
|
||||
let click_event = ClickEvent {
|
||||
let click_event = ClickEvent::Mouse(MouseClickEvent {
|
||||
down: MouseDownEvent {
|
||||
button: MouseButton::Right,
|
||||
position: event.position,
|
||||
@@ -634,7 +635,7 @@ impl RenderOnce for ButtonLike {
|
||||
modifiers: event.modifiers,
|
||||
click_count: 1,
|
||||
},
|
||||
};
|
||||
});
|
||||
(on_right_click)(&click_event, window, cx)
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user