Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Clicking disabled button selects next element

This simple code creates a disabled button:

import { Grid, IconButton } from "@material-ui/core";
import ArrowBackIosIcon from "@material-ui/icons/ArrowBackIos";

export default function App() {
  const handleClick = (e) => {
    e.stopPropagation();
  };

  return (
    <div className="App">
      <Grid container>
        <Grid item>Before</Grid>
        <Grid item>
          <IconButton disabled onClick={handleClick}>
            <ArrowBackIosIcon />
          </IconButton>
        </Grid>
        <Grid item>After</Grid>
      </Grid>
    </div>
  );
}

But when clicking on the button the "After" div gets selected. I have tried to prevent it by adding an event hanlder but it does not help.

How can I prevent "After" from being selected when clicking the enabled button?

here is my CodeSandBox: https://codesandbox.io/s/focused-elion-1tmtz0

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

here is i made changes https://codesandbox.io/s/immutable-paper-2ilsfh

Let me know if you need more help

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!