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

Remove any elements above input fields to fix cm #81

Merged
merged 3 commits into from
Oct 4, 2017
Merged

Remove any elements above input fields to fix cm #81

merged 3 commits into from
Oct 4, 2017

Conversation

LEDfan
Copy link
Owner

@LEDfan LEDfan commented Sep 28, 2017

Some sites (e.g. login.live.com) don't use the HTML5 placeholder tag but
uses a custom solution for this (probably because IE < 9 don't support
this). By adding this script we remove any DOM elements living in front
of the input field.

Fixes #80

@RobinJadoul please provide you opinion if this is the way to go, this has the potential to break some sites. We could also create some content_scripts specific for MS stuff, which are only loaded on the necessary sites. This makes Keywi somehow more bloated, but is probably more reliable.

@LEDfan LEDfan added the bug label Sep 28, 2017
@LEDfan LEDfan added this to the 1.1.0 milestone Sep 28, 2017
@RobinJadoul
Copy link
Collaborator

I'm afraid this may break too much.
Can we perhaps intercept a contextmenu event on overlapping area's and trigger it on the input?

@LEDfan
Copy link
Owner Author

LEDfan commented Sep 28, 2017

Can we perhaps intercept a contextmenu event on overlapping area's and trigger it on the input?

Tried something similar, the problem is that you can't trigger the ContextMenu from client side JS for security reasons.. (e.g. https://stackoverflow.com/questions/24690031/chrome-extension-trigger-context-menu)

@RobinJadoul
Copy link
Collaborator

RobinJadoul commented Sep 28, 2017

Maybe setting pointer-events: none is less harming?
https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

otherwise, something more like this might work: https://stackoverflow.com/a/2243086

Some sites (e.g. login.live.com) don't use the HTML5 placeholder tag but
uses a custom solution for this (probably because IE < 9 don't support
this). By adding this script we remove any click handlers on these DOM elements
living in front of the input field. The click event is then called on
the input field instead of the overlapping elements.

Signed-off-by: Tobia De Koninck <[email protected]>
@LEDfan
Copy link
Owner Author

LEDfan commented Sep 29, 2017

Maybe setting pointer-events: none is less harming?

This is an awesome idea and indeed works! Thanks! @RobinJadoul can you give this a last test?

 - rename fix-contenteditable.js to fix-contextmenu.js
 - add some comments about special parts of the code
 - replace setTimeout by a self calling function

Signed-off-by: Tobia De Koninck <[email protected]>
@LEDfan
Copy link
Owner Author

LEDfan commented Oct 4, 2017

@RobinJadoul done

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

Successfully merging this pull request may close these issues.

2 participants