Skip to content

Commit

Permalink
!fixup [REF] website: rewrite public widgets as interactions
Browse files Browse the repository at this point in the history
  • Loading branch information
romo-odoo authored and ged-odoo committed Jan 27, 2025
1 parent 9315791 commit 66d48d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ export class BaseHeaderSpecial extends BaseHeader {

if (this.hideEl) {
let elHeight = 0;
if (this.cssAffixed && this.searchbarEl?.matches(".show")) {
// Close the dropdown of the search bar if it's open when
// scrolling. Otherwise, the calculated height of the
// 'hideEl' element will be incorrect because it will
// include the dropdown height.
this.searchbarEl.querySelector("input").blur();
if (this.cssAffixed) {
// Close the dropdowns if they are open when scrolling.
// Otherwise, the calculated height of the 'hideEl' element will
// be incorrect because it will include the dropdown height.
this.hideEl.querySelectorAll(".dropdown-toggle.show").forEach(dropdownToggleEl => {
Dropdown.getOrCreateInstance(dropdownToggleEl).hide();
});
elHeight = this.hideEl.offsetHeight;
} else {
elHeight = this.hideEl.scrollHeight;
Expand Down
10 changes: 5 additions & 5 deletions addons/website/static/tests/tours/edit_menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ registerWebsitePreviewTour('edit_menus', {
},
{
content: "It didn't save without a label. Fill label input.",
trigger: ".modal:not(.o_inactive_modal) .modal-dialog .o_website_dialog input:eq(0)",
trigger: ".modal:not(.o_inactive_modal) .modal-dialog .o_website_dialog input:eq(0)",
run: "edit Random!",
},
{
Expand Down Expand Up @@ -199,7 +199,7 @@ registerWebsitePreviewTour('edit_menus', {
run: "click",
},
// Drag a block to be able to scroll later.
...insertSnippet({id: "s_media_list", name: "Media List", groupName: "Content"}),
...insertSnippet({ id: "s_media_list", name: "Media List", groupName: "Content" }),
...clickOnSave(),
clickOnExtraMenuItem({}, true),
{
Expand All @@ -224,7 +224,7 @@ registerWebsitePreviewTour('edit_menus', {
return helpers.drag_and_drop('.oe_menu_editor li:contains("Home")', {
position: {
top: 57,
left:5,
left: 5,
},
relative: true,
});
Expand Down Expand Up @@ -275,7 +275,7 @@ registerWebsitePreviewTour('edit_menus', {
run() {
// Scroll down.
this.anchor.closest("body").querySelector(".o_footer_copyright_name")
.scrollIntoView(true);
.scrollIntoView({ block: "start", inline: "nearest", behavior: "smooth" });
},
},
{
Expand Down Expand Up @@ -332,7 +332,7 @@ registerWebsitePreviewTour('edit_menus', {
{
content: "Check that the mega menu is opened",
trigger: ':iframe .top_menu .nav-item:has(a.o_mega_menu_toggle:contains("Megaaaaa!")) ' +
'.s_mega_menu_odoo_menu',
'.s_mega_menu_odoo_menu',
},
...clickOnEditAndWaitEditMode(),
{
Expand Down

0 comments on commit 66d48d3

Please sign in to comment.