-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lose focus after inputing one key in newitem input box with firefox browser #54
Comments
add one new issue: |
Hi @steven88888 - apologies for the delayed reply. Definitely a bug and something I'm looking into. It seems like something is invalidating the root node of the todomvc example, blurring the input. I'll keep you posted on progress. |
Just removed from app/index.js <Router onChange={this.handleRoute}><Noop path="/" /></Router> and all works fine. |
@c58 Ah yeah, that makes sense. That was a hack at best anyway, I should have just parsed the URL without pulling in |
I think i found the problem. Router's nodeType is 3 (text dom node), but it is not a "string" vnode, as expected in // attempt to pluck a node of the same type from the existing children
if (!child && min<childrenLen) {
for (let j=min; j<childrenLen; j++) {
let c = children[j];
if (c && isSameNodeType(c, vchild)) {
child = c;
children[j] = null;
if (j===childrenLen-1) childrenLen--;
if (j===min+1) min++;
break;
}
}
} In this case every update will make a redraw from the root, because new children is never equals to previous children. |
@c58 Hmm - this must be using the old version of How are you checking the nodeType value of Router? Also heads up: the child diffing algo is a bit different in 4.0. Still working on getting my branch pushed! |
Just debug in a browser :) Open page, write some letters in input, set a pointer in a line:
and write some letter in an input. And here we are, "c" is a dom node of a Router, vchild is a Router object. c.nodeType is 3. In my research im using preact 3.4.0 and router 1.2.3 |
If change function isSameNodeType(node, vnode) {
if (isString(vnode)) return node.nodeType === 3;
if (isFunctionalComponent(vnode)) return true;
var nodeName = vnode.nodeName;
if (isFunction(nodeName)) return node._componentConstructor === nodeName;
return toLowerCase(node.nodeName) === nodeName;
} then issues will be fixed |
Golf: diffLevel -» isRootDiff
open https://preact-todomvc.surge.sh in Firefox Browser (ESR 38.5.0 for Linux) and check adding item of the example, after inputing any key, the focus will lose.
But it works well without the same issue in Chrome Browser.
The text was updated successfully, but these errors were encountered: