salesforce / salesforce/design-system-react

onRequestClose vs onClose callbacks

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

Nobody has claimed this yet.

Estimate: Large
Dominant language
JavaScript
Stars
982
Forks
440
Avg merge
1d 21h
Merged PRs (30d)
4

Description

I propose that callbacks that handle state use the onRequest prefix and occur before the event and callbacks that are run after the "event" happens just be prefixed with on.

Consider a use case when a parent component wants to control Popover or Dropdown with isOpen. I get confused myself on when these callbacks occur and have to look at the source.

See item 3 in contributing docs about Controlled components

Contributor guide

Open the contributing guide

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 item 3, “Controlled and Uncontrolled Components,” in CONTRIBUTING.md, then inspect the Popover and Dropdown entry points mentioned in the issue. Compare when their onRequestClose and onClose callbacks run and determine the agreed naming convention and component scope before changing anything.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.