Dialog._dialogStack items focus property is not cleared, so the 0th item may hold a reference to an item removed from DOM i.e. kind of a leak. I suggest one of the following solutions:
- Stop using previous
ds item and just set previous focus to the current ds item.
- The
focus in the previous ds item is removed on hide().
- The
focus is held by a weak reference.