react-component / react-component/drawer

动画结束事件未正确触发,导致父元素样式未清除,以及对渲染至有滚动条的DOM中时的处理建议

Open
#141 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
425
Forks
108
Avg merge
2h 1m
Merged PRs (30d)
1

Description

官方Demo即可稳定复现,打开渲染至当前DOM的抽屉,再打开基础抽屉,然后关闭基础抽屉就会发现body的滚动条没了,body上的样式没有被清除。
在二次封装时发现是动画结束事件未触发,封装添加的样式就也没能被清除。

另外现在渲染至有滚动条的DOM中时,是将其scrollTop设置为0来保证能看到抽屉的,并且不会还原,只有在渲染至body时特殊处理了不影响滚动条,是否可以考虑使用getBoundingClientRect配合translateY来保证抽屉出现在可视区内呢?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the official demo and reproduce the sequence using “render to current DOM” and “basic drawer,” then inspect the drawer’s animation-end handling and scroll-container behavior. Done means the parent body styles are cleared after closing, and rendering into a scrollable DOM does not permanently reset its scroll position.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.