Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

228
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda