mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
fix(native): a long press in the app selects no text and opens no callout
In the iOS and Android app a long press on a label, card or image started a text selection, the magnifier or a "save image" menu, the clearest sign of a web page in a frame. startNativeApp marks <html> with data-native-app, and index.css then turns selection and the callout off for the UI. Inputs, textareas, selects and editors stay selectable so typing, pasting and the caret work; text worth copying opts in with .trek-selectable. A browser keeps its default.
This commit is contained in:
@@ -43,6 +43,7 @@ beforeEach(() => {
|
||||
vi.mocked(isEffectivelyOffline).mockReturnValue(false);
|
||||
vi.mocked(keepOfflineShellFresh).mockResolvedValue();
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.documentElement.removeAttribute('data-native-app');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -55,6 +56,12 @@ describe('startNativeApp', () => {
|
||||
startNativeApp();
|
||||
expect(App.addListener).not.toHaveBeenCalled();
|
||||
expect(StatusBar.setStyle).not.toHaveBeenCalled();
|
||||
expect(document.documentElement.hasAttribute('data-native-app')).toBe(false);
|
||||
});
|
||||
|
||||
it('marks <html> so a long press selects no text in the app', () => {
|
||||
startNativeApp();
|
||||
expect(document.documentElement.hasAttribute('data-native-app')).toBe(true);
|
||||
});
|
||||
|
||||
it("Android's back gesture closes an open sheet before it leaves the page", () => {
|
||||
|
||||
Reference in New Issue
Block a user