Tune the focus-visible heuristics a bit (#41314)
This isn't quite right yet, as a proper solution would remember the input modality at the moment of focus change, rather than at painting time. But this gets us close enough for now. Release Notes: - N/A
This commit is contained in:
@@ -115,6 +115,16 @@ impl InputEvent for MouseDownEvent {
|
||||
}
|
||||
impl MouseEvent for MouseDownEvent {}
|
||||
|
||||
impl MouseDownEvent {
|
||||
/// Returns true if this mouse up event should focus the element.
|
||||
pub fn is_focusing(&self) -> bool {
|
||||
match self.button {
|
||||
MouseButton::Left => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A mouse up event from the platform
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct MouseUpEvent {
|
||||
@@ -137,8 +147,19 @@ impl InputEvent for MouseUpEvent {
|
||||
PlatformInput::MouseUp(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl MouseEvent for MouseUpEvent {}
|
||||
|
||||
impl MouseUpEvent {
|
||||
/// Returns true if this mouse up event should focus the element.
|
||||
pub fn is_focusing(&self) -> bool {
|
||||
match self.button {
|
||||
MouseButton::Left => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A click event, generated when a mouse button is pressed and released.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct MouseClickEvent {
|
||||
@@ -482,6 +503,7 @@ impl InputEvent for MouseExitEvent {
|
||||
PlatformInput::MouseExited(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl MouseEvent for MouseExitEvent {}
|
||||
|
||||
impl Deref for MouseExitEvent {
|
||||
|
||||
Reference in New Issue
Block a user