react-component / react-component/dialog

Why binding mask handlers on wrap element instand of mask element?

Open
#178 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
455
Forks
206
Avg merge
12m
Merged PRs (30d)
1

Description

While I reading the source code, a question confuses me.
Why binding mask handlers on wrap element instand of mask element?
For example, the onMaskClick and onMaskMouseUp handlers.

    // At the end of Dialog.tsx.
    return (
      <div className={`${prefixCls}-root`}>
        {this.getMaskElement()}
        <div
          tabIndex={-1}
          onKeyDown={this.onKeyDown}
          className={`${prefixCls}-wrap ${props.wrapClassName || ''}`}
          ref={this.saveRef('wrap')}
          onClick={maskClosable ? this.onMaskClick : null}
          onMouseUp={maskClosable ? this.onMaskMouseUp : null}
          role="dialog"
          aria-labelledby={props.title ? this.titleId : null}
          style={style}
          {...props.wrapProps}
        >
          {this.getDialogElement()}
        </div>
      </div>
    );

Very grateful if someone tell me the reason.
And, please forgive my fool question.

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 Dialog.tsx and inspect the onMaskClick and onMaskMouseUp handlers, along with the wrap and mask elements shown in the issue. Trace how events are handled and record the reason for binding these handlers to the wrap element; done means the behavior is clearly explained for future readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.