Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Fix date picker not visible in slideshow sharing dialog #349

Merged

Conversation

danxuliu
Copy link
Member

@danxuliu danxuliu commented Jan 6, 2018

Fixes #313

The jQuery UI Datepicker Widget automatically sets the z-index of the date picker element to the z-index+1 of the element it is called on. However the server sets the z-index of the date picker using !important in its CSS files, so it overrides the value set directly on the element. As the z-index of the slideshow is 100000, the z-index of the date picker element set in the server is 1111, and the date picker element is a sibling of the slideshow element the date picker appears behind it and thus it is not visible.

But, why is the z-index explicitly set in the server CSS files if the widget automatically sets it? Because the automatic calculation of the z-index is flawed. The z-index of the element is got from the first ancestor (or itself) that has an absolute, relative or fixed position. However, the relevant z-index for the date picker element is the one from the ancestor element that is also a sibling of the date picker element, so depending on the DOM structure and CSS rules the automatic z-index could work or not, and thus an explicit z-index is needed instead.

Due to all this the problem has to be solved by overriding both the z-index set by the server CSS files and the z-index automatically set on the style attribute of the element, which fortunately can be done by setting the z-index with !important and a more specific selector than the one used in the server CSS file.

The z-index for the date picker is forced in the server CSS files to
"1111" through the use of "!important", so even if a higher value is
explicitly set in the "style" attribute of the element the value set in
the server CSS files is the one used. As the z-index of the slideshow is
"100000" and the date picker is added as a sibling of it and not as a
child the date picker appears behind the slideshow. In order to be
visible the date picker needs to override the z-index set in the server
CSS files to be higher than the one used for the slideshow and for the
share dialog shown in the slideshow.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu added 3. to review Waiting for reviews backport-request Pending backport by the backport-bot bug Something isn't working labels Jan 6, 2018
Copy link
Member

@rullzer rullzer left a comment

Choose a reason for hiding this comment

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

Seem to do the tick 🚀

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Tested and works 👍

@MorrisJobke MorrisJobke added this to the Nextcloud 13 milestone Jan 9, 2018
@MorrisJobke MorrisJobke merged commit 372035e into master Jan 9, 2018
@MorrisJobke MorrisJobke deleted the fix-date-picker-not-visible-in-slideshow-sharing-dialog branch January 9, 2018 13:50
@MorrisJobke
Copy link
Member

@danxuliu Could you open the backport PR?

@MorrisJobke
Copy link
Member

stable12 should be enough

@MorrisJobke MorrisJobke mentioned this pull request Jan 9, 2018
13 tasks
@MorrisJobke
Copy link
Member

Let me do the backport

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3. to review Waiting for reviews bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expiration date chooser is not shown
3 participants