Reparent file picker and viewer in fullscreen mode #6879
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #6119
Work around for #6151 until nextcloud-libraries/nextcloud-dialogs#427 and nextcloud/viewer#995 are fixed
By default the file picker and the viewer are siblings of the fullscreen element, so they are not visible when in fullscreen mode. It is not possible to specify the parent nor to know when the file picker or the viewer were actually opened, so for the time being they are reparented if needed shortly after calling them.
This is just a temporary hack until it is possible to specify the parent element, but that would require changes in the Vue library, the viewer and the server dialogs, so this horrible code will have to do for now 😢
A slightly better work around would be to look for the element to reparent several times in shorter intervals until it is found rather than just once after one second, but for simplicity I opted for the single timeout (but I can adjust it to the other approach if desired, of course).
How to test (scenario 1)
Result with this pull request
The file picker is shown (with a small lag)
Result without this pull request
The file picker is not shown until the fullscreen mode is left (for example, by pressing Esc)
How to test (scenario 2)
Result with this pull request
The viewer is shown (with a small lag)
Result without this pull request
The viewer is not shown until the fullscreen mode is left (for example, by pressing Esc)