Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

fixed keyboard shortcuts on MacOS [#7892]#7893

Merged
darkwing merged 3 commits into
firefox-devtools:masterfrom
bamanczak:bugfix/issue-7892
Feb 20, 2019
Merged

fixed keyboard shortcuts on MacOS [#7892]#7893
darkwing merged 3 commits into
firefox-devtools:masterfrom
bamanczak:bugfix/issue-7892

Conversation

@bamanczak
Copy link
Copy Markdown
Contributor

@bamanczak bamanczak commented Feb 6, 2019

Fixes #7892

Here's the Pull Request Doc
https://firefox-dev.tools/debugger.html/docs/pull-requests.html

Summary of Changes

  • Removed spaces from formatKeyShortcut function for MacOS consistency

Test Plan

  1. I verified manually that the fix updated the shortcuts on the initial load of debugger
  2. I run yarn test (Tests: 10 skipped, 1649 passed, 1659 total)

Copy link
Copy Markdown
Contributor

@errietta errietta left a comment

Choose a reason for hiding this comment

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

looks good

@errietta
Copy link
Copy Markdown
Contributor

errietta commented Feb 6, 2019

The test failures are unrelated, there's #7752 that should fix that

@darkwing
Copy link
Copy Markdown
Contributor

darkwing commented Feb 7, 2019

Nice work. I'd like others to weigh in here; the key representations look "bunched" or too close to me:

crunched1

I wonder if some letter-spacing would help out here. @violasong @fvsch

@fvsch
Copy link
Copy Markdown
Contributor

fvsch commented Feb 7, 2019

See #7892 (comment) for my comments about the font family.

For spacing, we could use some letter spacing for macOS only. Or we could use thin spaces:
http://www.fileformat.info/info/unicode/char/2009/index.htm
http://www.fileformat.info/info/unicode/char/200a/index.htm
http://www.fileformat.info/info/unicode/char/202f/index.htm

@violasong
Copy link
Copy Markdown

Changing the font-weight to normal may fix the bunched feeling.

@bamanczak
Copy link
Copy Markdown
Contributor Author

So right now we have this:
image

After trying out the suggestion from #7892 comment, it looks like this:
image
Which looks better if you ask me :)
But as I understand from the comment it would require additional testing? I would need some guidance to make sure we won't introduce any weird regression.

Changing font-weight makes no effect.

@fvsch
Copy link
Copy Markdown
Contributor

fvsch commented Feb 7, 2019

Applying the styles only to macOS requires a selector like:

:root[platform="mac"] .welcomebox .shortcutKey {
  ...
}

Which works for the Debugger in Firefox, but not in "Launchpad" mode (the HTML element doesn't have that attribute). It looks like instead the platform attribute is added to a div in the body, so the relevant selector would become:

:root[platform="mac"] .welcomebox .shortcutKey,
.launchpad-root[platform="mac"] .welcomebox .shortcutKey {
  ...
}

@darkwing, do you know if there is some automation in place that converts the first selector form to the second one? Or do we need to write both?

@fvsch
Copy link
Copy Markdown
Contributor

fvsch commented Feb 7, 2019

In launchpad mode I'm seeing styles like this, which seem to come from mozilla-central but the selector was tweaked:

:root.html [platform="linux"] {
    --monospace-font-family: monospace;
}

Original:

:root[platform="linux"] {
    --monospace-font-family: monospace;
}

@violasong
Copy link
Copy Markdown

Ah, my font-weight comment was based on David's screenshot but looks like your version is different. Latest version looks good but I miss the bolding of the shortcuts :)

@fvsch
Copy link
Copy Markdown
Contributor

fvsch commented Feb 8, 2019

If we use the mac system font we can probably use font-weight: 500 or font-weight: 600 to get a semibold variant.

@darkwing
Copy link
Copy Markdown
Contributor

Lots of good discussion here! @fvsch can you summarize the change to be made in one comment?

@bamanczak
Copy link
Copy Markdown
Contributor Author

I went through the comments and implemented them in a suggested way. Right now the welcomebox looks on Mac as follows:
image
Which I think is nice :)

Comment thread src/components/WelcomeBox.css Outdated
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */

:root[platform="mac"] .welcomebox .shortcutKey,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This rule should be placed after the styles for .welcomebox .shortcutKey, to keep a logical order.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do you think now it's the correct place? :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like it. :)

Comment thread src/components/WelcomeBox.css Outdated

:root[platform="mac"] .welcomebox .shortcutKey,
.launchpad-root[platform="mac"] .welcomebox .shortcutKey {
--monospace-font-family: monospace;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So I'm not very fond of the monospace font here. It looks like with font-family: monospace on a mac, Firefox may end up using Courier, which is not something we have elsewhere in DevTools. The --monospace-font-family CSS variable is actually defined so that we can specify a specific monospace font on each platform, so we shouldn't override it, even locally in some branch of the DOM.

It would be more interesting here IMO to try to use San Francisco, which seems to be the font used in the issue's screenshots. According to Can I Use, Firefox for Mac supports the -apple-system on macOS. For Chrome, it seems that the system-ui value is supported. So maybe something like:

[platform="mac"] .welcomebox .shortcutKey {
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 600;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This solutions seemed fine both on Chrome and FF. I also changed font-weight to 500, as it looks better.

@fvsch
Copy link
Copy Markdown
Contributor

fvsch commented Feb 19, 2019

@bamanczak Can you show updated screenshots of the result on Mac, in Firefox and Chrome?
If you think a different font-weight works better, feel free to propose that as well.

@bamanczak
Copy link
Copy Markdown
Contributor Author

As requested, screenshot from Chrome:
image
And from firefox
image

@darkwing
Copy link
Copy Markdown
Contributor

Thank you for the update @bamanczak ! We'll have a look!

@darkwing
Copy link
Copy Markdown
Contributor

I love this @bamanczak ! Thank you!

@darkwing darkwing merged commit 2ebfac2 into firefox-devtools:master Feb 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Space added between the characters in shortcuts on macOS

6 participants