From 5879b4721b1c2f85a65e2b4ee098cc00f74a247a Mon Sep 17 00:00:00 2001 From: ekas_7 Date: Thu, 18 Jun 2026 18:58:25 +0530 Subject: [PATCH] Add RFC: useSuppressKeyboard hook Proposes a new useSuppressKeyboard hook for declaratively suppressing the mobile virtual keyboard on focusable elements, with a layered cross-platform implementation strategy and honest drawbacks assessment. --- text/0000-suppress-virtual-keyboard.md | 509 +++++++++++++++++++++++++ 1 file changed, 509 insertions(+) create mode 100644 text/0000-suppress-virtual-keyboard.md diff --git a/text/0000-suppress-virtual-keyboard.md b/text/0000-suppress-virtual-keyboard.md new file mode 100644 index 00000000..6e4a7f78 --- /dev/null +++ b/text/0000-suppress-virtual-keyboard.md @@ -0,0 +1,509 @@ +# RFC: `useSuppressKeyboard` + +- Start Date: 2026-06-18 +- RFC PR: (leave this empty) +- React Issue: (leave this empty) + +--- + +# Summary + +`useSuppressKeyboard` is a proposed React hook that provides a first-class, +declarative API for preventing the mobile virtual (on-screen) keyboard from +appearing when a focusable element receives focus. It abstracts away a +collection of fragile, platform-inconsistent DOM workarounds behind a stable, +well-specified interface that integrates naturally with React's rendering and +ref models. + +--- + +# Basic Example + +```jsx +import { useSuppressKeyboard } from 'react'; + +function DatePickerTrigger() { + const ref = useSuppressKeyboard(); + + return ( + + ); +} +``` + +A boolean `enabled` option allows the suppression to be toggled at runtime: + +```jsx +function ConditionalInput({ isPickerMode }) { + const ref = useSuppressKeyboard({ enabled: isPickerMode }); + + return ; +} +``` + +The hook returns a `RefCallback` / `RefObject`-compatible ref that can be +passed directly to any host element. No wrapper components, no render props, +no imperative DOM mutations scattered across `useEffect` calls. + +--- + +# Motivation + +## The problem + +Mobile browsers display a virtual keyboard whenever a focusable element—most +commonly ``, `