Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 710c40c

Browse files
committed
Set autofocus on previously selected IdP if exist
1 parent 8c00275 commit 710c40c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99
- Social IdP has 'Sign in with' before name, Preferred IdP hasn't
1010
- Added possibility to change display name in attribute 'fullDisplayName' in metadata
1111
- If user's last selected IdP is known then show only this IdP and button to show all IdPs
12+
- Set autofocus on previously selected IdP if exist
1213

1314
#### Fixed
1415
- Fixed the bug in 'getEntitylesAttribute' function to return correct value of Entityless attribute

themes/perun/perun/disco-tpl.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
$this->data['head'] .= searchScript();
3232
$this->data['head'] .= showEntriesScript();
33+
$this->data['head'] .= setFocus();
3334

3435
const CONFIG_FILE_NAME = 'module_perun.php';
3536

@@ -122,7 +123,7 @@
122123
if (!$warningIsOn || $warningType === WARNING_TYPE_INFO || $warningType === WARNING_TYPE_WARNING) {
123124
if (!empty($this->getPreferredIdp())) {
124125
echo '<p class="descriptionp">' . $this->t('{perun:disco:previous_selection}') . '</p>';
125-
echo '<div class="metalist list-group">';
126+
echo '<div id="last-used-idp" class="metalist list-group">';
126127
echo showEntry($this, $this->getPreferredIdp(), true);
127128
echo '</div>';
128129

@@ -211,6 +212,21 @@ function searchScript()
211212
return $script;
212213
}
213214

215+
function setFocus()
216+
{
217+
$script = '<script type="text/javascript">
218+
219+
$(document).ready(function() {
220+
if ($("#last-used-idp")) {
221+
$("#last-used-idp .metaentry").focus();
222+
}
223+
});
224+
225+
</script>';
226+
227+
return $script;
228+
}
229+
214230
/**
215231
* @param DiscoTemplate $t
216232
* @param array $metadata

www/res/css/disco.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ a.metaentry:hover {
66
background-image: none;
77
}
88

9+
a.metaentry:focus {
10+
outline: none;
11+
background-color: rgba(0, 0, 0, 0.05);
12+
}
13+
914
a.metaentry.favourite {
1015
background-image: url(../../../../resources/icons/silk/star.png);
1116
background-position: 10px center;

0 commit comments

Comments
 (0)