From e6cb4fc269a2f2fb10982eeb8e107579274444e4 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Mon, 17 Jan 2022 20:19:53 +0000 Subject: [PATCH] Switch readonly values to readonly inputs It fits better in the layout after all. --- ui/widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/widget.js b/ui/widget.js index e275b58..350cbc2 100644 --- a/ui/widget.js +++ b/ui/widget.js @@ -126,7 +126,7 @@ export class Widget extends Component { break; } case 'text': - inputElem = readonly ? value : h(EditableInput, attrs); + inputElem = h(EditableInput, attrs); break; case 'toggle': { inputElem = h('input', { @@ -182,7 +182,7 @@ class EditableInput extends Component { ref = createRef(); shouldComponentUpdate() { - return document.activeElement !== this.ref.current; + return this.props.readonly || document.activeElement !== this.ref.current; } render(props) {