Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda