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

♿ Update amp-carousel focus styles for better color contrast (#29564) #30750

Merged
merged 8 commits into from
Oct 26, 2020

Conversation

dmanek
Copy link
Contributor

@dmanek dmanek commented Oct 20, 2020

@amp-owners-bot amp-owners-bot bot requested a review from zhouyx October 20, 2020 00:38
@dmanek
Copy link
Contributor Author

dmanek commented Oct 20, 2020

/cc @caroqliu

@caroqliu
Copy link
Contributor

caroqliu commented Oct 20, 2020

Looks good! What do you think about adding a visual-diff test for this?
image

@caroqliu
Copy link
Contributor

/invite @dmanek

@amp-invite-bot
Copy link

An invitation to join ampproject has been sent to @dmanek. I will update this thread when the invitation is accepted.

@amp-invite-bot
Copy link

The invitation to @dmanek was accepted!

@zhouyx
Copy link
Contributor

zhouyx commented Oct 20, 2020

LGTM.
You can add script to the visual diff test page, to mock the click event before capture the screenshot.
@caroqliu I don't think it's worth adding a standalone visual diff test just for this given visual diff test is relatively expensive. Is there an existing test that we can modify?

@dmanek
Copy link
Contributor Author

dmanek commented Oct 20, 2020

I didn't find any existing test that includes amp-carousel (amp-lightbox-gallery.html includes amp-carousel-0.1.js but does not use amp-carousel).

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2020

CLA assistant check
All committers have signed the CLA.

@caroqliu
Copy link
Contributor

I don't think it's worth adding a standalone visual diff test just for this given visual diff test is relatively expensive. Is there an existing test that we can modify?

@zhouyx good point, in that case I'd recommend modifying an existing unit test to check the CSS property values, similar to how @krdwan did here:

it('should have amp specific classes for CSS', () => {
const sections = element.children;
const {
firstElementChild: header0,
lastElementChild: content0,
} = sections[0];
const {
firstElementChild: header1,
lastElementChild: content1,
} = sections[1];
const {
firstElementChild: header2,
lastElementChild: content2,
} = sections[2];
// Check classes
expect(header0.className).to.include('i-amphtml-accordion-header');
expect(header1.className).to.include('i-amphtml-accordion-header');
expect(header2.className).to.include('i-amphtml-accordion-header');
expect(content0.className).to.include('i-amphtml-accordion-content');
expect(content1.className).to.include('i-amphtml-accordion-content');
expect(content2.className).to.include('i-amphtml-accordion-content');
// Check computed styles
expect(win.getComputedStyle(header0).margin).to.equal('0px');
expect(win.getComputedStyle(header0).cursor).to.equal('pointer');
expect(win.getComputedStyle(header0).backgroundColor).to.equal(
'rgb(239, 239, 239)'
);
expect(win.getComputedStyle(header0).paddingRight).to.equal('20px');
expect(win.getComputedStyle(header0).border).to.equal(
'1px solid rgb(223, 223, 223)'
);
expect(win.getComputedStyle(header1).margin).to.equal('0px');
expect(win.getComputedStyle(header1).cursor).to.equal('pointer');
expect(win.getComputedStyle(header1).backgroundColor).to.equal(
'rgb(239, 239, 239)'
);
expect(win.getComputedStyle(header1).paddingRight).to.equal('20px');
expect(win.getComputedStyle(header1).border).to.equal(
'1px solid rgb(223, 223, 223)'
);
expect(win.getComputedStyle(header2).margin).to.equal('0px');
expect(win.getComputedStyle(header2).cursor).to.equal('pointer');
expect(win.getComputedStyle(header2).backgroundColor).to.equal(
'rgb(239, 239, 239)'
);
expect(win.getComputedStyle(header2).paddingRight).to.equal('20px');
expect(win.getComputedStyle(header2).border).to.equal(
'1px solid rgb(223, 223, 223)'
);
expect(win.getComputedStyle(content0).margin).to.equal('0px');
expect(win.getComputedStyle(content1).margin).to.equal('0px');
expect(win.getComputedStyle(content2).margin).to.equal('0px');
});

@zhouyx zhouyx merged commit 131d74b into ampproject:master Oct 26, 2020
@dmanek dmanek deleted the issue-29564 branch October 26, 2020 18:47
ed-bird pushed a commit to ed-bird/amphtml that referenced this pull request Dec 10, 2020
…ect#29564) (ampproject#30750)

* Update amp-carousel focus styles for better color contrast (ampproject#29564)

* Add unit tests to verify focus style updates

* Removed console.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amp-carousel: Insufficient focus indication (outline color contrast)
5 participants