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

CSS examples: tabbing through the examples doesn't move the blue border+arrow #349

Closed
wbamberg opened this issue Nov 22, 2017 · 5 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior. p1 We will address this soon and will provide capacity from our team for it in the next few releases.

Comments

@wbamberg
Copy link
Contributor

If I've selected an example in the CSS editor and tab, I should move to the next example. I do (in that the next example is applied), but the blue border and arrow that's used to indicate the current example isn't updated.

@schalkneethling schalkneethling added bug Indicates an unexpected problem or unintended behavior. p1 We will address this soon and will provide capacity from our team for it in the next few releases. labels Nov 27, 2017
@schalkneethling schalkneethling self-assigned this Nov 27, 2017
@schalkneethling schalkneethling removed this from the Official version 1 Release milestone Jan 24, 2018
@diablero13
Copy link
Contributor

diablero13 commented Jan 25, 2018

I reviewed this issue and notice that bug have another causal relationship. Switching between examples via tab button occurs because of an improperly setuped event listener:

  exampleChoiceList.addEventListener('keyup', function(event) {
        var exampleChoiceParent = event.target.parentElement;

        cssEditorUtils.applyCode(
            exampleChoiceParent.textContent,
            exampleChoiceParent
        );

        if (!localStorage.getItem('firstCSSEditRecorded')) {
            mceAnalytics.trackFirstEdit('css');
        }
  })

The handler is called after each keystroke of any key (with focus on the list of examples) and applies the current code snippet. The problem is that this handler is also called when tab key is pressed; default behavior of tab is to switch focus between interactive HTML elements, including the <code /> element that containing code examples. This means that bug is related to unacceptable/incorrect behavior of focus switching between examples. Since acceptable keyboard control functionality is not implemented yet, so IMHO, good solution will be force disable tab navigation for <code /> element in code examples. @schalkneethling @wbamberg what do you think?

@schalkneethling
Copy link

@diablero13 That sounds like a great analysis. You want to grab this one?

@diablero13
Copy link
Contributor

Yes. Actually I already fixed it. I'll make PR soon.

@schalkneethling
Copy link

Awesome, thanks so mcuh

@schalkneethling
Copy link

Moved to mdn/bob#548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior. p1 We will address this soon and will provide capacity from our team for it in the next few releases.
Projects
None yet
Development

No branches or pull requests

3 participants