SolidJSS
SolidJS10mo ago
65 replies
McBrincie212

Updating a signal depending on if an element is focused or not

I want to update a signal on whenever a element gains focus or not(true / false)
<input
  style={{'border-radius': borderRadius()}}
  class={styles["input-text-element"]}
  name={"1"}
  ref={inputTextElement}
  onfocus={() => {
    setIsFocused(true);
    console.log("wtf?", isFocused())
  }}
  onblur={() => {setIsFocused(false)}}
/>


Tho if i do this, the focus gets used onfocus and doesn't trigger the expected behaiviour
Was this page helpful?