blessed icon indicating copy to clipboard operation
blessed copied to clipboard

button: don't focus on press

Open rib opened this issue 8 years ago • 3 comments

Automatically focusing a button on 'press' results in a 'blur' being emitted on the thing that loses focus which can have undesired side effects.

E.g. during a Textarea readInput a blur is taken to imply that the user navigated away from the textarea and so the input read is cancelled and a value of null is passed to the input callback.

Since a Prompt is based on a Textarea this in turn means the mouse can't be used to press the Okay button without a blur event being triggered which will result in a prompt value of null instead of the user's entered value.

Fixes: #249

rib avatar Jun 21 '16 21:06 rib

Nice fix, thanks for this. @chjj can we get this merged a year later?

CreativeCactus avatar Jun 10 '17 16:06 CreativeCactus

Focus also causes button look like focused when focus moved

ulcuber avatar May 17 '22 00:05 ulcuber

@rib @CreativeCactus I have added it there: https://github.com/ulcuber/blessed and released on npm

ulcuber avatar May 19 '22 18:05 ulcuber