Code Monkey home page Code Monkey logo

Comments (5)

mhevery avatar mhevery commented on May 3, 2024 3

I looked into it. The issue with this line: https://github.com/BuilderIO/qwik/blob/e4493e57f1e5bdad89b071ab0c824a9efd367e93/starters/apps/starter/src/my-app.tsx#L25

Notice that there is text + {' '}. Thes creates two text nodes. When these text nodes get serialized into HTML they get merged into one. Once the reconciliation algorithm runs the result is that the JSX does not match the HTML and results in the <input being destroyed and re-created. This results in a loss of focus.

I think the fix is to update the reconciliation algorithm to see when there is extra text and auto-create text nodes out of it. Should be a straightforward fix.

from qwik.

manucorporat avatar manucorporat commented on May 3, 2024 1

Fixed by 7fadd18

from qwik.

manucorporat avatar manucorporat commented on May 3, 2024

I noticed this issue too

from qwik.

jesperp avatar jesperp commented on May 3, 2024

Tried a few different scenarios and looked at the flash of updates in dev tools...

Original example
Screenshot 2021-12-25 at 21 16 55

Put the text in a paragraph (focus issue goes away)
Screenshot 2021-12-25 at 21 17 15

Placing the input as a lone sibling and things work as expected?
Screenshot 2021-12-25 at 21 34 33

Any ideas? 🤔

from qwik.

igrep avatar igrep commented on May 3, 2024

I found that the replaceNode function causes this by removing the input element before putting the mounted input. So perhaps it should keep focus after replacing. You'll see this by setting a break point for when the initial input element is removed.

from qwik.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.