Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
似乎原生 |
| open={visible || forceRender || animatedVisible} | ||
| autoDestroy={false} | ||
| getContainer={getContainer} | ||
| getContainer={isNil(getContainer) ? 'body' : getContainer} |
There was a problem hiding this comment.
This should not be a necessary change, Portal will check it's correct internally.
There was a problem hiding this comment.
rc-potral默认的挂载点似乎不太稳定,有可能虚拟dom渲染的时候挂载点还没添加到页面,或者添加后又被移除(visible为false的情况),导致autofocus失效。
这里相当于改用body作为默认挂载点。
There was a problem hiding this comment.
There was a problem hiding this comment.
我也觉得这是两件事。这个 PR 应该只管 Input focus 的问题。
There was a problem hiding this comment.
也许得先优化一下portal
https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/ReactDOMHostConfig.js#L522-L528
看出react的autofocus是用js模拟的,如何让react在https://github.com/react-component/portal/blob/master/src/useDom.tsx#L68 append之后模拟autofocus?
Codecov Report
@@ Coverage Diff @@
## master #361 +/- ##
==========================================
- Coverage 98.12% 97.61% -0.51%
==========================================
Files 7 7
Lines 160 168 +8
Branches 50 54 +4
==========================================
+ Hits 157 164 +7
- Misses 2 3 +1
Partials 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
@acyza 加个群? |
|
Hi, any news for this PR? |



fix ant-design/ant-design#41239
link #350
react中的
autoFocus似乎是react模拟的,并非原生的autofocus。https://github.com/facebook/react/blob/main/packages/react-dom-bindings/src/client/ReactDOMHostConfig.js#L522-L528rc-potral默认的挂载点似乎不太稳定,有可能虚拟dom渲染的时候挂载点还没添加到页面,或者添加后又被移除(visible为false的情况),导致autofocus失效。