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

167
Visualizações
On Tab press, focused element has a border, but when focusing element manually, it does not have border

I have dynamically loaded some li inside a div by ajax call in jQuery. I have coded the function to iterate through these li elements on up and down arrow key.

But I found a weird behavior of focus. When these elements are focused on Tab press, they have border around them, but when these elements are focused by down arrow(function I wrote), it is not having border.

Here is the code of function

    if (e.keyCode === 40 && elemID.includes("resultstagsid.")) {
                e.preventDefault();
                //$('#results a').eq(liIndex).removeClass("bg-gray")
                liIndex++
    // $('#results a').eq(liIndex).focus().addClass("bg-gray")
                $('#results a').eq(liIndex).focus()
    
                let scrollTo = $('#results a').eq(liIndex);
                let position = scrollTo.offset().top
                    - container.offset().top
                    + container.scrollTop();
    
                container.animate({
                    scrollTop: position
                });
            }

//Here is the code where li elements are being generated.

const result = $('#results');    
var html = "<ul>"
        for (var i = 0; i < results.length; i++) {
            let valu = fuzzysort.highlight(results[i]);
            html += "<li><a href='#' id='resultstagsid." + i + "' name='resultstagsid." + i + "' onclick='selectService(\"" + valu + "\"); ' class='resultsatags'>" + fuzzysort.highlight(results[i]) + "</a></li>"
        }
        html += "</ul>" 
    result.html(html)

Note : I am using Admin LTE template. I have also checked for the class if assigned for focused element. But couldn't find. I am trying to style the elements differently and removing border anyway, but I am curious about this behavior even I may be doing some mistake possibly, so please if anyone can explain this.

Here is the screenshot for both behavior

rounded border on focus

about 4 years ago · Santiago Gelvez
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