mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-04 05:15:41 -05:00
stop console opening mobile keyboard
This commit is contained in:
@@ -39,10 +39,13 @@ vi.mock('ghostty-web', () => ({
|
||||
this.renderedViewportY = viewportY;
|
||||
},
|
||||
};
|
||||
textarea: HTMLTextAreaElement | undefined;
|
||||
constructor(public options: ITerminalOptions) {
|
||||
terminals.push(this);
|
||||
}
|
||||
open() {}
|
||||
open(element: HTMLElement) {
|
||||
this.textarea = element.appendChild(document.createElement('textarea'));
|
||||
}
|
||||
loadAddon() {}
|
||||
registerLinkProvider() {}
|
||||
attachCustomKeyEventHandler() {}
|
||||
@@ -132,6 +135,15 @@ describe('useTerminal', () => {
|
||||
expect(Object.keys(theme)).toHaveLength(22);
|
||||
});
|
||||
|
||||
it('keeps the on-screen keyboard closed when the read-only terminal takes focus', async () => {
|
||||
const { container } = render(<Harness />);
|
||||
|
||||
await waitFor(() => expect(container.firstElementChild).toHaveAttribute('data-ready', 'true'));
|
||||
|
||||
expect(container.firstElementChild).toHaveAttribute('inputmode', 'none');
|
||||
expect(container.querySelector('textarea')).toHaveAttribute('inputmode', 'none');
|
||||
});
|
||||
|
||||
it('keeps a scrolled-up viewport on the same lines when new output arrives', async () => {
|
||||
const { container } = render(<Harness />);
|
||||
|
||||
|
||||
@@ -190,7 +190,11 @@ export const useTerminal = () => {
|
||||
const term = new Terminal({ ...terminalProps, ...style, ghostty });
|
||||
const fit = new FitAddon();
|
||||
|
||||
// Ghostty focuses its editable mount on open and its hidden textarea on tap, even with
|
||||
// stdin disabled; without this every server page opens the on-screen keyboard on mobile.
|
||||
mount.setAttribute('inputmode', 'none');
|
||||
term.open(mount);
|
||||
term.textarea?.setAttribute('inputmode', 'none');
|
||||
term.loadAddon(fit);
|
||||
fit.fit();
|
||||
fit.observeResize();
|
||||
|
||||
Reference in New Issue
Block a user