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

Fix personal settings fed scope tabindex #14808

Merged
merged 2 commits into from
Mar 25, 2019
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
5 changes: 5 additions & 0 deletions settings/css/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ select {
position: relative;
cursor: pointer;
margin-left: 10px;
&:focus {
.icon-federation-menu {
opacity: 0.7;
}
}
.icon-federation-menu {
padding-left: 16px;
background-size: 16px;
Expand Down
13 changes: 11 additions & 2 deletions settings/js/federationscopemenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@
_context: null,

events: {
'click a.action': '_onClickAction'
'click a.action': '_onSelectScope',
'keydown a.action': '_onSelectScopeKeyboard'
},

/**
* Event handler whenever an action has been clicked within the menu
*
* @param {Object} event event object
*/
_onClickAction: function(event) {
_onSelectScope: function(event) {
var $target = $(event.currentTarget);
if (!$target.hasClass('menuitem')) {
$target = $target.closest('.menuitem');
Expand All @@ -76,6 +77,14 @@
OC.hideMenus();
},

_onSelectScopeKeyboard: function(event) {
if (event.keyCode === 13 || event.keyCode === 32) {
// Enter and space can be used to select a scope
event.preventDefault();
this._onSelectScope(event);
}
},

/**
* Renders the menu with the currently set items
*/
Expand Down
10 changes: 10 additions & 0 deletions settings/js/federationsettingsview.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
});
$icon.append(scopeMenu.$el);
$icon.on('click', _.bind(scopeMenu.show, scopeMenu));
$icon.on('keydown', function(e) {
if (e.keyCode === 32) {
// Open the menu when the user presses the space bar
e.preventDefault();
scopeMenu.show(e);
} else if (e.keyCode === 27) {
// Close the menu again if opened
OC.hideMenus();
}
}.bind(this));

// Restore initial state
self._setFieldScopeIcon(field, self._config.get(field + 'Scope'));
Expand Down
2 changes: 1 addition & 1 deletion settings/js/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
templates['federationscopemenu'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression;

return " <li>\n <a href=\"#\" class=\"menuitem action action-"
return " <li tabindex=\"0\">\n <a href=\"#\" class=\"menuitem action action-"
+ alias4(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"name","hash":{},"data":data}) : helper)))
+ " permanent "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.active : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "")
Expand Down
2 changes: 1 addition & 1 deletion settings/js/templates/federationscopemenu.handlebars
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ul>
{{#each items}}
<li>
<li tabindex="0">
<a href="#" class="menuitem action action-{{name}} permanent {{#if active}}active{{/if}}" data-action="{{name}}">
{{#if iconClass}}
<span class="icon {{iconClass}}"></span>
Expand Down
14 changes: 7 additions & 7 deletions settings/templates/settings/personal/personal.info.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<form id="avatarform" class="section" method="post" action="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.postAvatar')); ?>">
<h3>
<label><?php p($l->t('Profile picture')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand Down Expand Up @@ -102,7 +102,7 @@
<form id="displaynameform" class="section">
<h3>
<label for="displayname"><?php p($l->t('Full name')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand All @@ -126,7 +126,7 @@
<form id="emailform" class="section">
<h3>
<label for="email"><?php p($l->t('Email')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand Down Expand Up @@ -169,7 +169,7 @@
<form id="phoneform" class="section">
<h3>
<label for="phone"><?php p($l->t('Phone number')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand All @@ -191,7 +191,7 @@
<form id="addressform" class="section">
<h3>
<label for="address"><?php p($l->t('Address')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand All @@ -213,7 +213,7 @@
<form id="websiteform" class="section">
<h3>
<label for="website"><?php p($l->t('Website')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand Down Expand Up @@ -262,7 +262,7 @@
<form id="twitterform" class="section">
<h3>
<label for="twitter"><?php p($l->t('Twitter')); ?></label>
<div class="federation-menu">
<div class="federation-menu" tabindex="0">
<span class="icon-federation-menu icon-password">
<span class="icon-triangle-s"></span>
</span>
Expand Down