kitodo-production icon indicating copy to clipboard operation
kitodo-production copied to clipboard

Open media in separate browser window

Open thomaslow opened this issue 1 year ago • 5 comments

Fixes #5887.

This pull request adds another menu item to the context menu of the metadata editor. It allows to open a page in a new browser window (depending on browser settings, usually a new tab). The media is shown similar to the media detail view in the meta data editor, meaning, images can be zoomed using OpenLayers, videos and audio is shown with a standard html5 video tag. There is no communication between the new window and the metadata editor. It is a simple static view of the media.

Demo video:

https://github.com/user-attachments/assets/51e0c936-b2e5-4818-95ed-de53d6d4ad51

thomaslow avatar Oct 21 '24 08:10 thomaslow

It would be very nice if we can also achieve the same behaviour, with a Ctrl/Str+Click on the node or the thumbnail.

BartChris avatar Oct 22 '24 08:10 BartChris

It would be very nice if we can also achieve the same behaviour, with a Ctrl/Str+Click on the node or the thumbnail.

I think CTRL + Click is currently reserved for multi-selecting pages so that would probably produce a conflict in the shortcuts.

solth avatar Oct 22 '24 12:10 solth

It would be very nice if we can also achieve the same behaviour, with a Ctrl/Str+Click on the node or the thumbnail.

I think CTRL + Click is currently reserved for multi-selecting pages so that would probably produce a conflict in the shortcuts.

Right... Maybe Alt+Click then?

BartChris avatar Oct 22 '24 12:10 BartChris

@BartChris I tried to implement your idea to open a new window with an alt+click. Unfortunately, there are multiple problems that are difficult to solve.

When using the mouse down event of a thumbnail, jQuery gets confused and thinks that the user wants to drag the thumbnail. So, when the user returns to the metadata editor, suddenly the thumbnail is being dragged around:

https://github.com/user-attachments/assets/875e0f3d-14c4-4143-b70d-8729cef2d84b

Unfortunately, the mouse up event can also not be used, because Primefaces prevents it from being triggered consistently. There is a Primefaces click handler that stops the mouse up event if the mouse is clicked quickly. The window is only opened when clicking "slowly" (like waiting 1 second between mouse down and mouse up).

Then there is the issue that the correct URL to open the window is current only updated when a thumbnail is selected.

All in all, I can only offer a alt+(double)-click. Meaning, if the thumbnail is not yet selected, there needs to be two clicks (one for selecting the thumbnail, and one for opening the window). If the thumbnail is already selected, a single alt+click is sufficient. Here is a demo:

https://github.com/user-attachments/assets/04c0829f-a320-4bb9-9e7e-f0cc7ab58c78

Personally, I wouldn't recommend to include this inconsistent mouse click behavior, which is probably confusing to the user. Unfortunately, I do not see a better solution at the moment.

thomaslow avatar Oct 28 '24 19:10 thomaslow

@thomaslow Thanks a lot for your investigation. I agree, that given the circumstances it would be of little value to add that. Maybe we can revisit this at a later point in time. The right-click menu is already a big improvement.

BartChris avatar Oct 29 '24 11:10 BartChris

@BartChris Thank you for your feedback. I agree with your idea to move the context menu entry to the second position. I updated the pull request accordingly.

thomaslow avatar Nov 05 '24 14:11 thomaslow