Commit 2d55b01
Zachary (zavan)
[FIX] mail : fix chatter suggestions position
# How to reproduce
- Go into any form view of a model with a chatter (e.g. Quotation)
- Add multiple long log notes. You need to be able to scroll enough to not see the last log note
- Click edit on the last log note
- Scroll down to the bottom
# The problem
An empty rectangle is displayed next to the log note in edit mode.
# Cause
The rectangle comes from the NavigableList Component, which is the list that displays suggestions when typing things like "@" or "#" :
https://github.com/odoo/odoo/blob/1fd44c3bb11a79d5b6aa72bf7de5a83e6c45be46/addons/mail/static/src/core/common/composer.xml#L137
This components uses the `usePostion()` hook, which purpose is to try to find the
most appropriate place to put the element. It will try different postions (e.g. on the left, below,
above, etc.) and will pick the most appropriate one. It will then adjust the element's style
to position it correctly. It is possible to ask for a preferred position using the options given
to the hook. This position will be prioritized over the others if it is suitable. In the case of
the NavigableList of the chatter, we give it either 'bottom-fit' or the 'top-fit' positions, wich means
it will prefer to be displayed above or below the message :
https://github.com/odoo/odoo/blob/dd84309df7fd39e9e97ed02d135d25b211085135/addons/mail/static/src/core/common/composer.js#L449-L459
But in our case, when we scroll back up, the position of the rectangle stays on the left, even
though the below space is available. That is because of this commit that introduced a
memorization of the last solution :
odoo@b2b8d2d
https://github.com/odoo/odoo/blob/f2434aac74324a65ccd81aa18c7b0e8318e59fde/addons/web/static/src/core/position/position_hook.js#L59-L61
This means that when we scroll down, the bottom positions fails and so the left one
is defaulted to. Since the position is memorized, it stays on the left. The issue with this
left position is that another commit introduced some logic that made it so if the
position is not "top" or "bottom", then we set the element's height to some value :
odoo@702748e
https://github.com/odoo/odoo/blob/f2434aac74324a65ccd81aa18c7b0e8318e59fde/addons/web/static/src/core/position/utils.js#L120-L124
And setting the height of the NavigableList makes it so it displayed even when there are
no suggestions inside, because the hiding mechanism of the suggestion list relies on the
fact that when there are no suggestions, the div is empty and has no height, so it is hidden.
# Propose solution
We introduce a settings in the options that will allow to skip the memorization of
the last position. Since the left position will never be set in the options, no height
will be defined.
opw-6172407
closes odoo#269769
X-original-commit: d6c5dc6
Signed-off-by: Bastien Fafchamps (bafa) <bafa@odoo.com>
Signed-off-by: Zachary Vanvlasselaer (zavan) <zavan@odoo.com>1 parent 24e33e6 commit 2d55b01
3 files changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
| 556 | + | |
556 | 557 | | |
557 | 558 | | |
558 | 559 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | | - | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| |||
0 commit comments