Skip to content
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
4 changes: 2 additions & 2 deletions lib/registries/addon/my-registrations/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class MyRegistrationsController extends Controller {
@tracked tab = 'submitted';

@action
changeTab(newTabId: string) {
this.tab = newTabId;
changeTab(newTabId: number) {
this.tab = newTabId === 1 ? 'submitted' : 'drafts';
}
}
13 changes: 10 additions & 3 deletions lib/registries/addon/my-registrations/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@
.NavTabs {
ul {
margin-left: 15px;
margin-bottom: 10px;
line-height: 20px;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
Comment on lines +28 to +30
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a question more than a request, but any reason you are not using the shorthand list-style: none; here? It looks like there's some safari bug for list-style: none according to this article, but also a macOS VoiceOver bug for list-style-type: none; according to this other page, so I didn't know if this was deliberate. FWIW, the ember-aria-tab folks seem to use list-style: none in their example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I think I just took these styles from the dev tools CSS inspection in order to try to match what was there before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, ok. I saw that there were those accessibility concerns pertaining to those properties and was curious if you came across something that proposed this particular implementation.

height: 41px;
padding: 0;
box-sizing: border-box;
}

.NavItem {
border: none;
color: #fff;
background: none;
padding: 10px 15px;
float: left;

&:hover {
border: none;
Expand All @@ -38,7 +47,7 @@
}
}

:global(.active) .NavItem {
:global(.ember-tabs__tab--selected) {
border: none;
color: $color-text-gray;
background-color: #e4e4e4;
Expand All @@ -55,8 +64,6 @@
}

.TabPane {
display: none;

&:global(.active) {
display: block;
}
Expand Down
58 changes: 18 additions & 40 deletions lib/registries/addon/my-registrations/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,69 +15,47 @@
</layout.heading>
<layout.main>
{{#if this.currentUser.user}}
<BsTab
<AriaTabs
local-class='NavTabs'
@customTabs={{true}}
@onChange={{this.changeTab}}
@activeId={{this.tab}}
@onSelect={{this.changeTab}}
@defaultIndex={{if (eq this.tab 'submitted') 1 0}}
as |tab|
>
<BsNav
@type='tabs'
<tab.tabList
as |nav|
>
<nav.item
<nav.tab
data-test-my-registrations-nav='drafts'
@active={{bs-eq tab.activeId 'drafts'}}
local-class='NavItem'
>
<button
data-test-my-registrations-nav-button='drafts'
local-class='NavItem'
type='button'
role='tab'
{{on 'click' (fn this.changeTab 'drafts')}}
>
{{t 'registries.my_registrations.drafts'}}
</button>
</nav.item>
<nav.item
{{t 'registries.my_registrations.drafts'}}
</nav.tab>
<nav.tab
data-test-my-registrations-nav='submitted'
@active={{bs-eq tab.activeId 'submitted'}}
local-class='NavItem'
>
<button
data-test-my-registrations-nav-button='submitted'
local-class='NavItem'
type='button'
role='tab'
{{on 'click' (fn this.changeTab 'submitted')}}
>
{{t 'registries.my_registrations.submitted'}}
</button>
</nav.item>
</BsNav>
{{t 'registries.my_registrations.submitted'}}
</nav.tab>
</tab.tabList>
<div
data-test-my-registrations-sort-description
local-class='SortDescription'
>
{{t 'registries.my_registrations.sorted'}}
</div>
<tab.pane
<tab.tabPanel
data-test-my-registrations-pane='drafts'
local-class='TabPane'
@title={{t 'registries.my_registrations.drafts'}}
@id='drafts'
>
<Registries::MyRegistrationsList::Drafts />
</tab.pane>
<tab.pane
</tab.tabPanel>
<tab.tabPanel
data-test-my-registrations-pane='submitted'
local-class='TabPane'
@title={{t 'registries.my_registrations.submitted'}}
@id='submitted'
>
<Registries::MyRegistrationsList::Registrations @user={{this.currentUser.user}} />
</tab.pane>
</BsTab>
</tab.tabPanel>
</AriaTabs>
{{/if}}
</layout.main>
</OsfLayout>
Expand Down
1 change: 1 addition & 0 deletions lib/registries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@glimmer/component": "*",
"@glimmer/tracking": "*",
"ember-angle-bracket-invocation-polyfill": "*",
"ember-aria-tabs": "*",
"ember-basic-dropdown": "*",
"ember-bootstrap": "*",
"ember-changeset": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,21 @@ module('Registries | Acceptance | my-registrations page', hooks => {
await visit('/registries/my-registrations');
assert.dom('[data-test-my-registrations-sort-description]').exists('Sort description shown');
assert.notOk(currentURL().includes('tab'), 'Tab query param not visible on submitted');
assert.dom('[data-test-my-registrations-nav="submitted"]').hasClass('active', 'Submitted tab is active');
assert.dom('[data-test-my-registrations-nav="drafts"]').doesNotHaveClass('active', 'Draft tab is not active');
assert.dom('[data-test-my-registrations-nav="submitted"]')
.hasClass('ember-tabs__tab--selected', 'Submitted tab is active');
assert.dom('[data-test-my-registrations-nav="drafts"]')
.doesNotHaveClass('ember-tabs__tab--selected', 'Draft tab is not active');
assert.dom('[data-test-my-registrations-pane="submitted"]').isVisible('Submitted pane is shown');
assert.dom('[data-test-my-registrations-pane="drafts"]').isNotVisible('Drafts pane is not shown');
assert.dom('[data-test-node-card]').exists({ count: 3 }, 'All submitted registrations shown');
await percySnapshot(assert);

await click('[data-test-my-registrations-nav-button="drafts"]');
await click('[data-test-my-registrations-nav="drafts"]');
assert.ok(currentURL().includes('tab=drafts'), 'Tab query param visible on drafts');
assert.dom('[data-test-my-registrations-nav="drafts"]').hasClass('active', 'Drafts tab is active');
assert.dom('[data-test-my-registrations-nav="submitted"]').doesNotHaveClass('active',
'Submitted tab is not active');
assert.dom('[data-test-my-registrations-nav="drafts"]')
.hasClass('ember-tabs__tab--selected', 'Drafts tab is active');
assert.dom('[data-test-my-registrations-nav="submitted"]')
.doesNotHaveClass('ember-tabs__tab--selected', 'Submitted tab is not active');
assert.dom('[data-test-my-registrations-pane="drafts"]').isVisible('Drafts pane is shown');
assert.dom('[data-test-my-registrations-pane="submitted"]').isNotVisible('Submitted pane is not shown');
assert.dom('[data-test-draft-registration-card]').exists({ count: 2 }, 'All drafts shown');
Expand Down