Giter Site home page Giter Site logo

Comments (6)

martin654 avatar martin654 commented on August 25, 2024

Description in this ticket:
#11818

"Since PF 13.0.6, setting the focus with the 'focus' attribute in the 'dialog' no longer works. The element briefly gains focus and then immediately loses it again. This still worked in PF 13.0.5."

looked like it could be related

from primefaces.

martin654 avatar martin654 commented on August 25, 2024

Looks like it is caused by this change:
bc7bc91

from primefaces.

melloware avatar melloware commented on August 25, 2024

Thanks for the reproducer let me debug this issue.

from primefaces.

melloware avatar melloware commented on August 25, 2024

@martin654 great reproducer this was tricky to debug. What is happening is both dialogs called show before the first hide is executed and the delay is causing the focus change. here is the debug.

applyFocus ajaxDialog
Start AJAX
applyFocus searchDialog
Complete AJAX
returnFocus 
<button id="frmTest:openDialogButton" 

Working on a fix

from primefaces.

melloware avatar melloware commented on August 25, 2024

pf-11860.zip

I included a monkeyPatch in your test.js can you give it a try?

if (PrimeFaces.widget.Dialog) {
  PrimeFaces.widget.Dialog.prototype.returnFocus = function () {
    var el = this.focusedElementBeforeDialogOpened;
    if (el) {
      // #11860 do not return focus if other dialogs are still open
      var otherDialogs = $(".ui-dialog:visible").length > 0;
      if (otherDialogs) {
        return;
      }
      setTimeout(function () {
        el.focus({ preventScroll: true });
      }, 100);
    }
  };
}

from primefaces.

martin654 avatar martin654 commented on August 25, 2024

@melloware Thank you for the fix, works great in 13.0.10.

from primefaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.