Fix anchor change when clicking on sharing page menu

The share menu toggle and some share menu items included an 'href="#"'
attribute, so they were handled as internal links by the browser, which
changed the current anchor when they were clicked. However, there was no
real need to change the anchor in those cases, and it could interfere
with other apps (for example, the PDF viewer sets the current anchor to
"#pdfviewer" when it is shown and it hides itself when that anchor is
modified). According to the HTML 5 spec the "href" attribute is not
mandatory for "a" elements, so they were removed.

Other options would have been to change the elements from "a" to "div"
or something like that, but that would have required changes to the CSS
rules too, or to prevent the default event handling for those elements
through JavaScript, which would have been a workaround instead of the
proper solution.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2017-12-21 13:52:03 +01:00
parent dc8809e754
commit eb256b3ed5
1 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
<div class="header-right">
<?php if (!isset($_['hideFileList']) || (isset($_['hideFileList']) && $_['hideFileList'] === false)) { ?>
<a href="#" id="share-menutoggle" class="menutoggle icon-more-white"><span class="share-menutoggle-text"><?php p($l->t('Download')) ?></span></a>
<a id="share-menutoggle" class="menutoggle icon-more-white"><span class="share-menutoggle-text"><?php p($l->t('Download')) ?></span></a>
<div id="share-menu" class="popovermenu menu">
<ul>
<li>
@ -60,7 +60,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
</a>
</li>
<li>
<a href="#" id="directLink-container">
<a id="directLink-container">
<span class="icon icon-public"></span>
<label for="directLink"><?php p($l->t('Direct link')) ?></label>
<input id="directLink" type="text" readonly value="<?php p($_['previewURL']); ?>">
@ -68,7 +68,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
</li>
<?php if ($_['server2serversharing']) { ?>
<li>
<a href="#" id="save" data-protected="<?php p($_['protected']) ?>"
<a id="save" data-protected="<?php p($_['protected']) ?>"
data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>">
<span class="icon icon-external"></span>
<span id="save-button"><?php p($l->t('Add to your Nextcloud')) ?></span>