react-component / react-component/trigger

重复触发 onPopupVisibleChange

Open
#84 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
391
Forks
245
PR merge metrics
No merged PRs in 30d

Description

onPopupVisibleChange(popupVisible) {
    this.setState({ popupVisible })
}

  <Trigger
    action={['click']}
    popup={this.renderMenu('inline')}
    popupAlign={{
      points: ['tl', 'bl'],
      offset: [0, 3]
    }}
    popupVisible={this.state.popupVisible}
    onPopupVisibleChange={::this.onPopupVisibleChange}
    mask
    destroyPopupOnHide
  >
    <div className="mobile-trigger">
      <Icon type="bars"/>
    </div>
  </Trigger>

里面的 mobile-trigger 点击后展开菜单。然后再点击后应该关闭的。但是却重复触发了事件,导致关闭后立刻打开了。

感觉像是点击穿透问题, fastclick 也用了,也无效。

document.addEventListener('DOMContentLoaded', () => FastClick.attach(document.body), false)

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 from the Trigger usage shown in the issue and reproduce the mobile-trigger click sequence with popupVisible and mask enabled. Trace the onPopupVisibleChange calls, including the FastClick setup, and confirm that one click closes the menu without immediately reopening it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.