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

169
Vistas
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 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