Prevent soft keyboard briefly dropping when focus lost because a button was pressed

1 week ago 9
ARTICLE AD BOX

I have implemented a search facility on text in an html textarea.

When a button is pressed, the search text is found in the text, the textarea is scrolled to bring the found text into view, the textarea is focussed, and the found text is selected using setSelectionRange.

Each subsequent press of the button shows the next occurrence of the searched for text.

In Firefox, and the Firefox derivative Waterfox, the soft keyboard pops up on the first click and remains solidly in place for all subsequent clicks.

In Chrome, and the derived DuckDuckGo browser, the soft keyboard drops briefly on each subsequent click before coming back up.

I have tried using an event-listener as suggested here, but the keyboard still briefly drops.

Clearly Mozilla have spotted this problem and implemented a fix. Google have yet to catch up. Assuming they won't for some time, or never, is there a solution? How do other developers handle this?

Read Entire Article