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

[FIX] web_editor: tooltip with wrong information shows up #162621

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

Conversation

adsa-odoo
Copy link
Contributor

@adsa-odoo adsa-odoo commented Apr 19, 2024

Current behaviour before commit:

  • Hovering on any block of snippet options pannel shows up a tooltip with text 'This block cannot be dropped anywhere
    on this page' which is not true. The block can be dropped anywhere. This happens because of this commit 1.

  • However, the popover should be shown only when the snippet cannot be dropped anywhere. This situation occurs when a
    user has no editing rights. This can be reproduced like this:

  1. Login as admin and edit demo user, only give him the restricted editor right, remove everything else (alternatively switch the user from internal to public user to remove all rights then back from public to internal user, this field is only in debug mode).
  2. Now login as demo user.
  3. Go to website home page.
  4. Enter edit mode.
  5. All snippets are disabled, because you don't have access rights to edit.
  • Right now, when we try to show tooltip on this particular condition it doesn't work because the block element contains
    'o_disabled' class which applies a CSS rule 'pointer-events: none' that prevents to show tooltip.

Desired behaviour after commit:

The tooltip should be shown only when block is disabled.

task-3875067


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Apr 19, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 19, 2024
@deso-odoo deso-odoo marked this pull request as ready for review April 23, 2024 04:56
@C3POdoo C3POdoo requested a review from a team April 23, 2024 04:57
Copy link
Contributor

@rdeodoo rdeodoo left a comment

Choose a reason for hiding this comment

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

Well, now it won't be wrongly shown indeed, since it won't be show ever since it's fully removed.

I don't see any explanation whatsoever in the commit message..

  • Why is this happening?
  • Since when is it happening?
  • How was it behaving before the bug?
  • What about previous version?

Checking 2 minutes on runbot in each versions, you can have a glimpse of information:

  • In Odoo 15, that tooltip was correctly showing
    image
  • In Odoo 16 and later, no title was shown anymore, since a pointer-event: none rule was introduced (apparently, from quickly looking)
  • In master with owl conversion done here it went from JS to XML
  • It's also that commit which changed the wording from No location to drop in to This block cannot be dropped anywhere on this page.

So it's maybe fine to just remove it, since it is not working since v16, but it should really come with some investigation and explanation.

And after investigating, one could actually wonder if it would not be better to replace the pointer-event none by something else to keep the title (but still prevent drag & drop, and maybe change the cursor to disabled visually). Without the title, it's IMO a bit confusing, you can't do it (drag & drop) but you don't know why.

I'll leave the rest up to you / RD India to check what you judge best, but please always come with some investigation and some reason / historical explanation of why is it done.

@adsa-odoo
Copy link
Contributor Author

@rdeodoo Hello, thanks for the review.

Well, the the root cause of the bug is that there is no such condition for displaying tooltip only when the block is disabled. As result tooltip is shown everywhere. When I checked the prior versions from 16.0, there was no such tooltip overthere. But even when I tried to show the tooltip using condition it was not working because of pointer-events: none. Since the spec was to remove the tooltip at all, I removed and didn't mention in the commit message as the spec was not to keep the tooltip at all.

@rdeodoo
Copy link
Contributor

rdeodoo commented Apr 23, 2024

Well, the the root cause of the bug is that there is no such condition for displaying tooltip only when the block is disabled.

Due to the recent commit I mentioned, as I explained.

When I checked the prior versions from 16.0, there was no such tooltip over there. But even when I tried to show the tooltip using condition it was not working because of pointer-events: none.

Exactly what I had to investigate and what I explained indeed

Since the spec was to remove the tooltip at all, I removed and didn't mention in the commit message as the spec was not to keep the tooltip at all.

In all cases, full removal or making it work as before, always provide an explanation of what's going on in master and what happened in previous version (basically the full investigation I quickly made above).

Also, the spec is IMO wrong, I don't know who wrote the get fully rid of it, but it's IMO worst than fixing it. The tooltip really provided added value (when it worked) as I explained. A disabled snippet with a ❗ symbol does not mean much, while a title is really adding value as it's very clearly explaining what's going on.

Could you:

  • Explain all I explained in the commit msg, including reference to recent ARD commit (nice to have: also include the pointer-event non)
  • Try to make it work again (workaround the pointer-event), if you see it's too much work, I guess it's fine to fully remove it, but that would be sad. Quickly looking I found this thread https://moshfeu.github.io/show-tooltip-on-pointer-events-none-element/

@adsa-odoo adsa-odoo force-pushed the master-tooltip-lying-adsa branch 5 times, most recently from b2c4c1b to eb45707 Compare April 26, 2024 09:55
@adsa-odoo
Copy link
Contributor Author

@rdeodoo Hello, I came up with a solution to show the tooltip. Here what we are doing is we are adding tooltip to the child element of the block and setting pointer-events: auto to make it work. Can you please have a look?

Copy link
Contributor

@rdeodoo rdeodoo left a comment

Choose a reason for hiding this comment

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

Nice 👍

A step to reproduce would be really great:

  • Login as admin and edit demo user, only give him the restricted editor right, remove everything else (alternatively switch the user from internal to public user to remove all rights then back from public to internal user, this field is only in debug mode).
  • Now login as demo user
  • Go to a product page
  • Enter edit mode
  • All snippets are disabled, because you don't have access rights to product

Something like that.

We should definitely consider backporting it after this one is merged (here in master it's also fixing 91293fe)

t-att-class="{ 'o_we_already_dragging': snippet.renaming }"
t-att-data-snippet="snippet.baseBody.dataset.snippet"
t-att-style="snippet.disabled ? 'pointer-events: auto; cursor: not-allowed;' : ''"
t-att-data-tooltip="snippet.disabled ? 'This block cannot be dropped anywhere on this page.' : ''">
Copy link
Contributor

Choose a reason for hiding this comment

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

This need to fallback on false, not empty string, so qweb doesn't set the attribute.
Otherwise, it will just look like this when it's not disabled:
image

<div class="oe_snippet_thumbnail"
t-att-class="{ 'o_we_already_dragging': snippet.renaming }"
t-att-data-snippet="snippet.baseBody.dataset.snippet"
t-att-style="snippet.disabled ? 'pointer-events: auto; cursor: not-allowed;' : ''"
Copy link
Contributor

Choose a reason for hiding this comment

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

While applying the below remark about data-tooltip, can you quickly triple check if there is no classes related those 2 style properties? If it's the case, it could be moved in the t-att-class
(Don't create it if not exist, keep it like this)

Current behaviour before commit:

-Hovering on any block of snippet options pannel shows up a
 tooltip with text 'This block cannot be dropped anywhere
 on this page' which is not true. The block can be dropped
 anywhere. This happens because of this commit [1]. However,
 the popover should be shown only when the snippet cannot be
 dropped anywhere. This situation occurs when a user has no
 editing rights.

-Right now, when we try to show tooltip on this particular
 condition it doesn't work because the block element contains
 'o_disabled' class which applies a CSS rule 'pointer-events:
 none' that prevents to show tooltip.

Desired behaviour after commit:

The tooltip should be shown only when block is disabled.

[1]: 91293fe

task-3875067
@rdeodoo
Copy link
Contributor

rdeodoo commented May 17, 2024

@adsa-odoo Don't forget to ping on the PR once you have made the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants