Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sc: remove context-menu-layer for autofill context-menu #10784

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bayramcicek
Copy link
Member

@bayramcicek bayramcicek commented Dec 20, 2024

  • generate a left mouse click so that a single click can select a cell after closing the autofill context menu.
  • we avoid the second click to select a cell after autofill context menu is opened.
  • this only applies to the autofill context-menu. other context menus should not be affected.

Change-Id: Iaf7b5c09003291f27155ae9ab6787f2f871ac466

  • Resolves: #
  • Target version: master

Checklist

  • I have run make prettier-write and formatted the code.
  • All commits have Change-Id
  • I have run tests with make check
  • I have issued make run and manually verified that everything looks okay
  • Documentation (manuals or wiki) has been updated or is not required

@bayramcicek
Copy link
Member Author

  • this fixes the double click issue on autofill contextmenu. but prevents the contextmenu from closing itself when scrolling and opening another popups...

  • a working example:

Peek.2024-12-20.14-45.mp4

@eszkadev eszkadev added the draft label Dec 27, 2024
@eszkadev
Copy link
Contributor

is it finished? or still draft/wip ?

@bayramcicek
Copy link
Member Author

is it finished? or still draft/wip ?

still WIP. I'm trying to fix some issues.

- generate a left mouse click so that a single click can select a cell after closing the autofill context menu.
- we avoid the second click to select a cell after autofill context menu is opened.
- this only applies to the autofill context-menu. other context menus should not be affected.

Signed-off-by: Bayram Çiçek <[email protected]>
Change-Id: Iaf7b5c09003291f27155ae9ab6787f2f871ac466
@bayramcicek bayramcicek force-pushed the private/bayram/fix-double-click-cell-autofill branch from 0be6fd4 to 594b2f8 Compare January 3, 2025 10:13
@bayramcicek bayramcicek marked this pull request as ready for review January 3, 2025 10:14
@bayramcicek bayramcicek removed the draft label Jan 3, 2025
@bayramcicek
Copy link
Member Author

before: (master)

Peek.2025-01-03.12-55-master.mp4

after:

Peek.2025-01-03.12-58-after.mp4

@bayramcicek bayramcicek self-assigned this Jan 3, 2025
@bayramcicek bayramcicek requested a review from eszkadev January 3, 2025 11:58
// generate a left mouse click so that a single click can select a cell
// after closing the autofill context menu
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, isn't the autofill menu generated in online?
or do we pass it from core? (I don't remember)

Copy link
Member Author

@bayramcicek bayramcicek Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autofill contextmenu is generated in online. (only items in the context menu send UNO command to the core.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but does it take any data from core to create that popup?
if NOT use core at all to invoke popup -> this approach is possibly wrong -> why we would need to do additional click in core while popup was online only? or I missed something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but does it take any data from core to create that popup? if NOT use core at all to invoke popup -> this approach is possibly wrong -> why we would need to do additional click in core while popup was online only? or I missed something?

yes, that's right. Is there any way to do additional click on the online? I thought _postMouseEvent is on the online.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then - adding a click feels like workaround. It would be good to be able to answer: why we need additional click?

Do we have present .jsdialog-overlay on the screen maybe? Or the map/canvas is not in focus?
Do you have some logs from the browser - what happens just after the first click?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then - adding a click feels like workaround.

  • yes. we can say that it is a workaround.

It would be good to be able to answer: why we need additional click?

  • after opening the autofill contexmenu there is a id="context-menu-layer" that blocks scroll and clicking on the cells.
  • if we click on a cell -to select it-, it does not click the cell but removes the layer. So if we add an additional click at this point, then we can click on the cell we are on - after that layer was removed - without need to double click.

Do we have present .jsdialog-overlay on the screen maybe?

  • we have id="context-menu-layer"

Screenshot_20250103_163658

Or the map/canvas is not in focus?
gets focus after contextmenu is hidden.

Control.ContextMenu.js:219

					hide: function() {
						if(autoFillContextMenu)
							app.map._docLayer._resetReferencesMarks();
						map.focus();
					}

Do you have some logs from the browser - what happens just after the first click?

hide: function() ^^^ executes and id="context-menu-layer" is removed. then auto contextmenu is closed.

Copy link
Contributor

@eszkadev eszkadev Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. what about something like:

diff --git a/browser/src/control/Control.ContextMenu.js b/browser/src/control/Control.ContextMenu.js
index aecb8a6fe7..c7a13d264c 100644
--- a/browser/src/control/Control.ContextMenu.js
+++ b/browser/src/control/Control.ContextMenu.js
@@ -204,9 +204,22 @@ L.Control.ContextMenu = L.Control.extend({
                                                var $menu = opt.$menu;
                                                $menu.attr('tabindex', 0); // Make the context menu focusable
                                        },
+                                       activated: function (opt) {
+                                               console.error('activated');
+                                               console.error(opt);
+
+                                               var $layer = opt.$layer;
+                                               $layer.css('pointer-events', 'none'); // layer doesn't get mouse clicks
+
+                                               $layer.on('mousedown', function () {
+                                                       console.error('This click handler will not be fired');
+                                               });
+                                       },
                                        hide: function() {
-                                               if(autoFillContextMenu)
+                                               if(autoFillContextMenu) {
                                                        app.map._docLayer._resetReferencesMarks();
+                                                       console.error('but this will be still fired thanks to entry in context menu');
+                                               }
                                                map.focus();

activated event is called when context menu is built and ready to use.
We can just remove the layer on show but.. perfect would be to just not handle clicks to avoid errors inside jQuery.

you can read also internals of jQuery: browser/node_modules/jquery-contextmenu/src/jquery.contextMenu.js for interesting details

@eszkadev
Copy link
Contributor

eszkadev commented Jan 3, 2025

did you test that with multiple users?
A: open autofill
B: tries to click to move cursor somewhere

does the autofil from A view have impact on B?

@bayramcicek
Copy link
Member Author

did you test that with multiple users? A: open autofill B: tries to click to move cursor somewhere

does the autofil from A view have impact on B?

my experience with multiple users seem work as expected. (or should it behave different?)

Peek.2025-01-03.15-26.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Review
Development

Successfully merging this pull request may close these issues.

2 participants