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

Replace jQuery show animation with CSS animation in sidebar #11044

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions browser/css/cool.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,21 @@ body {
overflow: hidden;
z-index: 990;
}

#sidebar-dock-wrapper.visible {
display: block;
animation: 200ms ease-out appear-from-right;
}

@keyframes appear-from-right {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}

#sidebar-panel {
padding: 0px;
margin: 0px;
Expand Down
7 changes: 3 additions & 4 deletions browser/src/control/Control.Sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class Sidebar {
}

isVisible(): boolean {
return $('#sidebar-dock-wrapper').is(':visible');
return $('#sidebar-dock-wrapper').hasClass('visible');
}

closeSidebar() {
$('#sidebar-dock-wrapper').hide();
$('#sidebar-dock-wrapper').removeClass('visible');
this.map._onResize();

if (!this.map.editorHasFocus()) {
Expand Down Expand Up @@ -236,8 +236,7 @@ class Sidebar {
}

this.builder.build(this.container, [sidebarData]);
if (!this.isVisible())
$('#sidebar-dock-wrapper').show(this.options.animSpeed);
if (!this.isVisible()) $('#sidebar-dock-wrapper').addClass('visible');

this.map.uiManager.setDocTypePref('ShowSidebar', true);
} else {
Expand Down
2 changes: 1 addition & 1 deletion cypress_test/integration_tests/common/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ function getBlinkingCursorPosition(aliasName) {
var cursorSelector = '.cursor-overlay .blinking-cursor';
cy.cGet(cursorSelector).then(function(cursor) {
var boundRect = cursor[0].getBoundingClientRect();
var xPos = boundRect.right;
var xPos = (boundRect.left + boundRect.right) / 2;
var yPos = (boundRect.top + boundRect.bottom) / 2;
cy.wrap({x: xPos, y: yPos}).as(aliasName);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Scroll through document',
}

// Document should scroll
desktopHelper.assertScrollbarPosition('horizontal', 80, 110);
desktopHelper.assertScrollbarPosition('horizontal', 115, 145);
});

it('Scroll while selecting with mouse', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Sheet switching tests', fu
it('Check view position on repeated selection of currently selected sheet', function() {
// initially we are on sheet 2 tab
cy.cGet(helper.addressInputSelector).should('have.prop', 'value', 'F720');
desktopHelper.assertScrollbarPosition('vertical', 260, 300);
desktopHelper.assertScrollbarPosition('vertical', 300, 340);

// click on sheet 2 tab (yes, current one)
cy.cGet('#spreadsheet-tab1').click();
cy.cGet(helper.addressInputSelector).should('have.prop', 'value', 'F720');
desktopHelper.assertScrollbarPosition('vertical', 220, 285);
desktopHelper.assertScrollbarPosition('vertical', 300, 340);

// go to different place in the spreadsheet
cy.cGet(helper.addressInputSelector).type('{selectAll}A2{enter}');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,14 @@ describe(['taga11yenabled'], 'Editable area - Basic typing and caret moving', fu
ceHelper.type('{enter}');
ceHelper.type('green red');
// Need to wait here after typing paragraph in
// order for caret position to stick later
cy.wait(200);
// order for caret position to stick later.
// FIXME: We shouldn't need to wait.
cy.wait(1000);
ceHelper.checkPlainContent('green red');
ceHelper.moveCaret('left', '', 4);
ceHelper.checkCaretPosition(5);
helper.getBlinkingCursorPosition('P2');
cy.wait(800);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not happy about the size of these waits, but these seemed to be the minimum values to get this test to pass consistently locally. Both of these are masking a real bug, I can easily replicate the failure with manual inputs and it doesn't mirror the behaviour in desktop Writer. This seems very similar to #10585 and I wouldn't be surprised if the underlying reason is basically the same.

// move up to paragraph 3
ceHelper.moveCaret('up');
ceHelper.checkPlainContent('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ describe(['tagmultiuser'], 'Check cursor and view behavior', function() {
cy.cSetActiveFrame('#iframe1');
searchHelper.typeIntoSearchField('P'); // avoid focus loss
searchHelper.typeIntoSearchField('Pellentesque porttitor');
desktopHelper.assertScrollbarPosition('vertical', 375, 385);
desktopHelper.assertScrollbarPosition('vertical', 380, 390);

// verify that second view is scrolled to the editor
cy.cSetActiveFrame('#iframe2');
desktopHelper.assertScrollbarPosition('vertical', 375, 385);
desktopHelper.assertScrollbarPosition('vertical', 380, 390);

// now move cursor a bit in the first view
cy.cSetActiveFrame('#iframe1');
cy.cGet('#map').type('{downArrow}{downArrow}{downArrow}{downArrow}{downArrow}{downArrow}');

// verify that second view is still at the same position (no jump)
cy.cSetActiveFrame('#iframe2');
desktopHelper.assertScrollbarPosition('vertical', 375, 385);
desktopHelper.assertScrollbarPosition('vertical', 380, 390);
});
});