reactjs / reactjs/react.dev

alert() not working in codepen, consider alternative onclick functions for tutorial

Open
#3,656 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

https://github.com/reactjs/reactjs.org/blob/master/content/tutorial/tutorial.md

At some part of this tutorial (um, line 238 of that md file), I was asked to give the squares an onclick function of alert("click"). However, apparently Chrome has blocked this from running in codepen (A different origin subframe tried to create a JavaScript dialog. This is no longer allowed and was blocked. See https://www.chromestatus.com/feature/5148698084376576 for more details.), and can be confusing to people.

The next best alternative for alert that I can think of is console.log, and logged messages can be seen in both the browser's console and codepen's console.

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

Open content/tutorial/tutorial.md around line 238 and review the squares' alert("click") handler in the CodePen example. Verify an alternative such as console.log works in both the browser and CodePen consoles; the work is done when the example no longer triggers the blocked dialog and remains understandable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.