fix(player): keep Delete and Home editing text in player sheets
Bare Backspace and Home are player navigation keys, but they are also caret editing keys. The player screen's Focus wraps its OverlaySheetHost, so it saw them before the subtitle-search field could act: the press was consumed on key-down, DefaultTextEditingShortcuts never turned it into a deletion, and the back pipeline hid the chrome and then left the player. A focused text editor now takes both keys back, but only for physical keyboard presses — a synthesized dpad/gamepad press has no caret, and browserHome has no editing role at all. The screen also resolved its overlay-sheet controller from the State's own context, which sits above the host it was querying, so the lookup always returned null and Back skipped the sheet stage entirely. Resolve it from a context below the host instead, matching NowPlayingScreen. close #1741
This commit is contained in:
@@ -362,6 +362,56 @@ void main() {
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('surrenders bare Backspace to a focused text editor', () {
|
||||
final event = _navigationKeyDown(LogicalKeyboardKey.backspace, ui.KeyEventDeviceType.keyboard);
|
||||
|
||||
expect(
|
||||
classifyPlayerNavigationKey(event, isAppleTV: false, hasModifiers: false, textEditingActive: true),
|
||||
PlayerNavigationKey.none,
|
||||
);
|
||||
expect(
|
||||
classifyPlayerNavigationKey(event, isAppleTV: false, hasModifiers: false, textEditingActive: false),
|
||||
PlayerNavigationKey.back,
|
||||
);
|
||||
});
|
||||
|
||||
test('surrenders bare Home to a focused text editor but never browser Home', () {
|
||||
expect(
|
||||
classifyPlayerNavigationKey(
|
||||
_navigationKeyDown(LogicalKeyboardKey.home, ui.KeyEventDeviceType.keyboard),
|
||||
isAppleTV: false,
|
||||
hasModifiers: false,
|
||||
textEditingActive: true,
|
||||
),
|
||||
PlayerNavigationKey.none,
|
||||
);
|
||||
// browserHome has no caret role, so an editor never takes it.
|
||||
expect(
|
||||
classifyPlayerNavigationKey(
|
||||
_navigationKeyDown(LogicalKeyboardKey.browserHome, ui.KeyEventDeviceType.keyboard),
|
||||
isAppleTV: false,
|
||||
hasModifiers: false,
|
||||
textEditingActive: true,
|
||||
),
|
||||
PlayerNavigationKey.home,
|
||||
);
|
||||
});
|
||||
|
||||
test('keeps simulated remote Home navigating while a text editor has focus', () {
|
||||
for (final deviceType in [ui.KeyEventDeviceType.directionalPad, ui.KeyEventDeviceType.gamepad]) {
|
||||
expect(
|
||||
classifyPlayerNavigationKey(
|
||||
_navigationKeyDown(LogicalKeyboardKey.home, deviceType),
|
||||
isAppleTV: false,
|
||||
hasModifiers: false,
|
||||
textEditingActive: true,
|
||||
),
|
||||
PlayerNavigationKey.home,
|
||||
reason: 'a synthesized remote press has no caret to move',
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
group('handlePlayerNavigationKeyAction', () {
|
||||
|
||||
Reference in New Issue
Block a user