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

222
Views
onBlur event working on chrome but not working on safari?

I am having issues about onBlur event with react-typescript. To recreate the issues I hit upButton to make the nights go to 9+ and it's the maximum and if user keep clicking upButton it will appear the error above the input.

Here is the image: enter image description here and here is my code base:

class MvSpinner extends React.Component<Props, MvSpinnerState> {
  constructor(props:Props) {
    super(props);
    this.upButton = this.upButton.bind(this);
    this.downButton = this.downButton.bind(this);
    this.clear = this.clear.bind(this);
    this.drawResult = this.drawResult.bind(this);
    this.state = {
      text: "",
      open: false,
      showSoftError: false,
      showHardError: false,
    };
  }

  upButton() {
    let currentValue = this.props.value;
    if (currentValue === this.props.max) {
      this.setState({ showSoftError: true, showHardError: true });
    }

    if (currentValue < this.props.max && !this.props.disabled) {
      currentValue++;
      this.drawResult();
      this.onChange(currentValue);
    }

  }

  downButton() {
    let currentValue = this.props.value;
    if (currentValue > this.props.min && !this.props.disabled) {
      currentValue--;
      this.drawResult();
      this.onChange(currentValue);
    }
  }

  clear() {
    this.setState({
      open: true
    });
  }

  drawResult() {
    this.setState({
      open: false,
      showSoftError: false,
      showHardError: false,
    });
  }

    return (
         ...
        <label className="visuallyhidden" htmlFor={this.props.name}>{this.props.label}</label>
        {content}
        <div className="spinner-controls">
          <button
            tabIndex={-1}
            aria-label="increment"
            className="spinner-control-up"
            type="button"
            onBlur={this.drawResult}
            onClick={this.upButton}
          />
          <button
            tabIndex={-1}
            aria-label="decrement"
            className="spinner-control-down"
            type="button"
            onClick={this.downButton}
          />
        </div>
        <div className="error tool-tip">
          <div
            className={"tool-tip-popup " + (err ? "show" : "")}
            style={this.props.errorStyle}
          >
            <p>{err}</p>
          </div>
        </div>
     ...
);

when I click outside of the upButton it will disspear the error tooltip but when I switch to safari it did not work. Does anyone have idea how to fix this error ????

Thanks!!!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Why blur and focus doesn't work on Safari? - try the simplest search first.

And class components are not used anymore.

about 4 years ago · Juan Pablo Isaza 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!