Revert 'Accessibility: focus management in topics'

reverts:

- 3df0626aa5
- 3212cdda78
- 59b7760e2e
- bfc1301823
This commit is contained in:
Arpit Jalan 2018-02-22 10:30:39 +05:30
parent f74d6bb605
commit d170c8fccc
5 changed files with 10 additions and 43 deletions

View File

@ -30,9 +30,8 @@ export default Ember.Component.extend(bufferedRender({
rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'], rerenderTriggers: ['bulkSelectEnabled', 'topic.pinned'],
tagName: 'tr', tagName: 'tr',
classNameBindings: [':topic-list-item', 'unboundClassNames', 'topic.visited'], classNameBindings: [':topic-list-item', 'unboundClassNames', 'topic.visited'],
attributeBindings: ['data-topic-id', 'tabindex'], attributeBindings: ['data-topic-id'],
'data-topic-id': Em.computed.alias('topic.id'), 'data-topic-id': Em.computed.alias('topic.id'),
'tabindex': 0,
actions: { actions: {
toggleBookmark() { toggleBookmark() {

View File

@ -89,8 +89,6 @@ export default {
this._bindToClick(binding.click, key); this._bindToClick(binding.click, key);
} }
}); });
this._bindFocus();
}, },
toggleBookmark() { toggleBookmark() {
@ -310,19 +308,6 @@ export default {
} }
}, },
_bindFocus() {
const addSelected = function(e, addOrRemove) {
const row = '.topic-post, .topic-list-item, .topic-list tbody tr';
const $wrapper = $(e.target).closest(row);
const $srcWrapper = $(e.relatedTarget).closest(row);
if (!$wrapper.is($srcWrapper)) $wrapper.toggleClass('selected', addOrRemove);
};
const $document = $(document);
$document.on('focusin.topic-post', e => addSelected(e, true));
$document.on('focusout.topic-post', e => addSelected(e, false));
},
_moveSelection(direction) { _moveSelection(direction) {
const $articles = this._findArticles(); const $articles = this._findArticles();
@ -330,15 +315,9 @@ export default {
return; return;
} }
let $selected = $articles.filter(function(_, el) { const $selected = ($articles.filter('.selected').length !== 0)
return el.contains(document.activeElement); // :focus ? $articles.filter('.selected')
}); : $articles.filter('[data-islastviewedtopic=true]');
if ($selected.length === 0) {
$selected = $articles.filter('.selected');
}
if ($selected.length === 0) {
$selected = $articles.filter('[data-islastviewedtopic=true]');
}
let index = $articles.index($selected); let index = $articles.index($selected);
if ($selected.length !== 0) { //boundries check if ($selected.length !== 0) { //boundries check
@ -375,11 +354,10 @@ export default {
$article.addClass('selected'); $article.addClass('selected');
if ($article.is('.topic-post')) { if ($article.is('.topic-post')) {
$('article', $article).focus(); $('a.tabLoc', $article).focus();
this._scrollToPost($article); this._scrollToPost($article);
} else { } else {
$article.focus();
this._scrollList($article, direction); this._scrollList($article, direction);
} }
} }

View File

@ -394,11 +394,11 @@ createWidget('post-article', {
}, },
buildAttributes(attrs) { buildAttributes(attrs) {
return { 'data-post-id': attrs.id, 'data-user-id': attrs.user_id, 'tabindex': '0' }; return { 'data-post-id': attrs.id, 'data-user-id': attrs.user_id };
}, },
html(attrs, state) { html(attrs, state) {
const rows = []; const rows = [h('a.tabLoc', { attributes: { href: ''} })];
if (state.repliesAbove.length) { if (state.repliesAbove.length) {
const replies = state.repliesAbove.map(p => { const replies = state.repliesAbove.map(p => {
return this.attach('embedded-post', p, { model: this.store.createRecord('post', p), state: { above: true } }); return this.attach('embedded-post', p, { model: this.store.createRecord('post', p), state: { above: true } });

View File

@ -6,20 +6,10 @@
box-shadow: -3px 0 0 $danger; box-shadow: -3px 0 0 $danger;
} }
.mobile-view {
.topic-list tr.selected td:first-child, .topic-list-item.selected td:first-child, .topic-post.selected {
box-shadow: none;
}
}
.topic-list-item.selected { .topic-list-item.selected {
background-color: inherit; background-color: inherit;
} }
.topic-post article:focus, .topic-list tr:focus, .topic-list-item:focus {
outline: 0;
}
.keyboard-shortcuts-modal .modal-body { .keyboard-shortcuts-modal .modal-body {
max-height: 560px; max-height: 560px;
} }

View File

@ -126,7 +126,7 @@ nav.post-controls {
border: none; border: none;
margin-left: 3px; margin-left: 3px;
&.d-hover, &:focus { &.d-hover {
background: $primary-low; background: $primary-low;
color: $primary; color: $primary;
} }
@ -142,12 +142,12 @@ nav.post-controls {
position: relative; position: relative;
} }
&.delete.d-hover, &.delete:focus { &.delete.d-hover {
background: $danger; background: $danger;
color: $secondary; color: $secondary;
} }
&.like.d-hover, &.like:focus { &.like.d-hover {
color: $love; color: $love;
background: $love-low; background: $love-low;
} }