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: fix colorpicker position in iframe #160505

Closed

Conversation

Mtaylorr
Copy link
Contributor

@Mtaylorr Mtaylorr commented Apr 4, 2024

Issue:

Colorpicker doesn't appear in mass mailing

Steps to reproduce the issue:

  • Create a new mass mailing with a some template other than plain text
  • Try to change the color of some text
  • The position of the colorpicker is wrong.

Origin of the issue:

When wysiwyg was converted to owl in 1, an effort was made to speed up the loading of the iframe in mass_mailing. One of the changes that were done in that regard was to remove assets from the iframe to make it load faster. This required to create the sidebar (SnippetsMenu) outside of the iframe since the iframe did not have the required files anymore, and insert it back in the iframe afterwards, since it was designed to work inside the iframe.

This change actually had an impact on the positioning of the colorpicker, and basically anything that relied on popper.js for positioning, because since popper.js was outside of the iframe then the checks it did based on instanceof HTMLElement were returning false for every node inside the iframe. At the time of 1 this went unnoticed because the chatter was not yet in the side of the screen for mass_mailing, so the wrong positioning of the colorpicker was actually only slightly off the right position, thus being hard to catch while not specifically looking for that particular issue.

As soon as the chatter was made to be on the side even in the case of mass_mailing, the wrong colorpicker position became visible but the issue went unnoticed at the time as well, probably because the two changes were completely unrelated. This went live in saas-16.4 and is the case in 17.0 as well. However, the issue does not exist anymore in saas-17.1 due to the refactor of mass_mailing to have the sidebar (SnippetsMenu) working from outside of the iframe instead of inside.

Solution:

Fixing this issue properly would require huge changes to how the SnippetsMenu is constructed and would most likely require going back to the slow iframe with all the assets inside. That would not be a desirable outcome, especially in a stable version. With that in mind, and considering the issue doesn't exist in saas-17.1, we decided it was a prime example where a local change in the popper.js library was actually the best fix. The library is very unlikely to be updated in a stable version and the change won't reach saas-17.1.

co-authored with dmo-odoo

task-3614965

@robodoo
Copy link
Contributor

robodoo commented Apr 4, 2024

Pull request status dashboard.

@Mtaylorr Mtaylorr force-pushed the saas-16.4-task-3614965-macr branch from 434dfd4 to 739b850 Compare April 4, 2024 12:10
@Mtaylorr
Copy link
Contributor Author

Mtaylorr commented Apr 4, 2024

@fw-bot up to 17.0

@fw-bot
Copy link
Contributor

fw-bot commented Apr 4, 2024

Forward-porting to '17.0'.

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 4, 2024
Issue:
======
Colorpicker doesn't appear in mass mailing

Steps to reproduce the issue:
=============================
- Create a new mass mailing with a some template other than plain text
- Try to change the color of some text
- The position of the colorpicker is wrong.

Origin of the issue:
====================
When wysiwyg was converted to owl in [1], an effort was made to
speed up the loading of the iframe in mass_mailing. One of the
changes that were done in that regard was to remove assets from
the iframe to make it load faster. This required to create the
sidebar (SnippetsMenu) outside of the iframe since the iframe did
not have the required files anymore, and insert it back in the
iframe afterwards, since it was designed to work inside the iframe.

This change actually had an impact on the positioning of the
colorpicker, and basically anything that relied on popper.js for
positioning, because since popper.js was outside of the iframe then
the checks it did based on `instanceof HTMLElement` were returning
false for every node inside the iframe. At the time of [1] this
went unnoticed because the chatter was not yet in the side of the
screen for mass_mailing, so the wrong positioning of the colorpicker
was actually only slightly off the right position, thus being hard
to catch while not specifically looking for that particular issue.

As soon as the chatter was made to be on the side even in the case
of mass_mailing, the wrong colorpicker position became visible but
the issue went unnoticed at the time as well, probably because the
two changes were completely unrelated. This went live in saas-16.4
and is the case in 17.0 as well. However, the issue does not exist
anymore in saas-17.1 due to the refactor of mass_mailing to have
the sidebar (SnippetsMenu) working from outside of the iframe
instead of inside.

Solution:
=========
Fixing this issue properly would require huge changes to how the
SnippetsMenu is constructed and would most likely require going
back to the slow iframe with all the assets inside. That would not
be a desirable outcome, especially in a stable version. With that
in mind, and considering the issue doesn't exist in saas-17.1, we
decided it was a prime example where a local change in the popper.js
library was actually the best fix. The library is very unlikely to
be updated in a stable version and the change won't reach saas-17.1.

[1]: odoo@76d4f98
co-authored with dmo-odoo

task-3614965
@Mtaylorr Mtaylorr force-pushed the saas-16.4-task-3614965-macr branch from 739b850 to 2088237 Compare April 5, 2024 07:38
@dmo-odoo dmo-odoo marked this pull request as ready for review April 18, 2024 13:57
@C3POdoo C3POdoo requested review from a team, aab-odoo and Iucapad and removed request for a team April 18, 2024 14:04
@dmo-odoo
Copy link
Contributor

@robodoo r+

robodoo pushed a commit that referenced this pull request Apr 23, 2024
Issue:
======
Colorpicker doesn't appear in mass mailing

Steps to reproduce the issue:
=============================
- Create a new mass mailing with a some template other than plain text
- Try to change the color of some text
- The position of the colorpicker is wrong.

Origin of the issue:
====================
When wysiwyg was converted to owl in [1], an effort was made to
speed up the loading of the iframe in mass_mailing. One of the
changes that were done in that regard was to remove assets from
the iframe to make it load faster. This required to create the
sidebar (SnippetsMenu) outside of the iframe since the iframe did
not have the required files anymore, and insert it back in the
iframe afterwards, since it was designed to work inside the iframe.

This change actually had an impact on the positioning of the
colorpicker, and basically anything that relied on popper.js for
positioning, because since popper.js was outside of the iframe then
the checks it did based on `instanceof HTMLElement` were returning
false for every node inside the iframe. At the time of [1] this
went unnoticed because the chatter was not yet in the side of the
screen for mass_mailing, so the wrong positioning of the colorpicker
was actually only slightly off the right position, thus being hard
to catch while not specifically looking for that particular issue.

As soon as the chatter was made to be on the side even in the case
of mass_mailing, the wrong colorpicker position became visible but
the issue went unnoticed at the time as well, probably because the
two changes were completely unrelated. This went live in saas-16.4
and is the case in 17.0 as well. However, the issue does not exist
anymore in saas-17.1 due to the refactor of mass_mailing to have
the sidebar (SnippetsMenu) working from outside of the iframe
instead of inside.

Solution:
=========
Fixing this issue properly would require huge changes to how the
SnippetsMenu is constructed and would most likely require going
back to the slow iframe with all the assets inside. That would not
be a desirable outcome, especially in a stable version. With that
in mind, and considering the issue doesn't exist in saas-17.1, we
decided it was a prime example where a local change in the popper.js
library was actually the best fix. The library is very unlikely to
be updated in a stable version and the change won't reach saas-17.1.

[1]: 76d4f98
co-authored with dmo-odoo

task-3614965

closes #160505

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
@robodoo robodoo closed this Apr 23, 2024
@fw-bot fw-bot deleted the saas-16.4-task-3614965-macr branch May 7, 2024 10:47
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

5 participants