Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add "Open in new window" option to links #2628

Merged
merged 9 commits into from Sep 5, 2017

Conversation

Projects
None yet
4 participants
Collaborator

notnownikki commented Aug 31, 2017 edited

Fixes #2204

@notnownikki notnownikki Add "Open in new window" option to links d68baaa

codecov bot commented Aug 31, 2017 edited

Codecov Report

Merging #2628 into master will increase coverage by 0.14%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2628      +/-   ##
==========================================
+ Coverage   31.42%   31.56%   +0.14%     
==========================================
  Files         177      178       +1     
  Lines        5407     5613     +206     
  Branches      946      988      +42     
==========================================
+ Hits         1699     1772      +73     
- Misses       3135     3233      +98     
- Partials      573      608      +35
Impacted Files Coverage Δ
blocks/editable/index.js 12.3% <0%> (+1.77%) ⬆️
blocks/editable/format-toolbar/index.js 6.38% <0%> (-1.12%) ⬇️
blocks/library/latest-posts/index.js 7.4% <0%> (-2.6%) ⬇️
blocks/api/registration.js 100% <0%> (ø) ⬆️
blocks/library/gallery/gallery-image.js 50% <0%> (ø) ⬆️
...ebar/post-taxonomies/hierarchical-term-selector.js 0% <0%> (ø) ⬆️
blocks/library/gallery/block.js 11.76% <0%> (ø)
components/drop-zone/provider.js 1.98% <0%> (+0.64%) ⬆️
blocks/library/button/index.js 28.57% <0%> (+1.9%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5885233...02d0e6d. Read the comment docs.

blocks/editable/format-toolbar/index.js
@@ -130,6 +146,13 @@ class FormatToolbar extends Component {
isActive: !! formats[ control.format ],
} ) );
+ // TODO: make this not look hideous
+ const linkSettings = settingsVisible && (
@youknowriad

youknowriad Aug 31, 2017

Collaborator

Have you considered using the Popover component?

@notnownikki

notnownikki Aug 31, 2017

Collaborator

Nope, mainly because I didn't know what it was 😄 Looks like a good way to have this visibility state managed for us, although I don't think it would help with my awful design skills?

@notnownikki

notnownikki Sep 1, 2017

Collaborator

I've switched this to use a popover, but it still looks really bad. I'm not sure what markup we need to have this render like the wireframes, and there's nowhere that we're actually using a PopoverContext for me to see how to get this rendering nicely, either. Also, there are focus issues once you toggle the checkbox (click the settings icon, toggle the checkbox, then you have to click the settings icon twice to close the Popover, as I think the first click takes the focus away from the Popover, which feels bad.)

notnownikki added some commits Sep 1, 2017

@notnownikki notnownikki Works, but still looks awful 8e77332
@notnownikki notnownikki lint 84c7233
@notnownikki notnownikki Remove popover, use ToggleControl 6dfd3e3
Collaborator

notnownikki commented Sep 1, 2017

This works now, and is using the correct form components, but for the life of me I can't get the settings to appear below the toolbar, they just squish everything up. Perhaps @karmatosed can work some magic here, or advise me?

@mtias mtias Display link-settings below the input and button tools. 79d54cb
Contributor

mtias commented Sep 1, 2017

Tweaked the styling a bit:

image

@notnownikki notnownikki Remove TODO, as it no longer looks hideous 8f5ff68
@notnownikki notnownikki Set aria-expanded correctly e0df077
Collaborator

notnownikki commented Sep 4, 2017

I've set aria-expanded correctly now, and made sure that keyboard navigation works as expected. Here's what it looks like expanding the expanded settings using the keyboard:

keyboard nav for link settings

Perhaps @afercia could make sure I've got this right? Happy to squash and merge if everything looks ok :)

Should we leave the settings visible when we toggle the target? They are being closed in my testing

blocks/editable/format-toolbar/index.js
@@ -93,6 +99,17 @@ class FormatToolbar extends Component {
};
}
+ toggleLinkSettingsVisibility() {
+ const settingsVisible = ! this.state.settingsVisible;
+ this.setState( { settingsVisible } );
@youknowriad

youknowriad Sep 4, 2017

Collaborator

there's an implicit coding standard stating that if the next state depends on the previous, we should use the callback notation (I think we were trying to add an eslint for this in an old PR)

this.setState( ( state ) => ( { settingsVisible: ! state.settingsVisible } ) );
@notnownikki

notnownikki Sep 5, 2017

Collaborator

Fixed!

Collaborator

youknowriad commented Sep 4, 2017

Am I the only one seeing this design bug

screen shot 2017-09-04 at 13 13 26

Collaborator

notnownikki commented Sep 4, 2017

@youknowriad I'm not seeing either of those things happen... what browser/OS?

Collaborator

notnownikki commented Sep 4, 2017

(that is, setting stay open when I toggle the setting, and the toolbar doesn't jump to the next line)

Collaborator

youknowriad commented Sep 4, 2017

Weird!!! MacOS Chrome Version 60.0.3112.113. I reproduce in Firefox too 55.0.3 (64 bits)

Collaborator

notnownikki commented Sep 4, 2017

I see the setting icon wrap onto the next line in firefox, but I can't reproduce the "settings close when setting is toggled" thing in any browser.

I'll have to defer to someone else to fix the wrapping bug though, still not sure how to get that working correctly

Collaborator

notnownikki commented Sep 4, 2017

Hmm, perhaps there's a click event we need to stop bubbling up somewhere? I can't see where that would be though, the settings fieldset isn't inside the IconButton...

Member

karmatosed commented Sep 4, 2017

The grumpy z-index monster is back:

2017-09-04 at 15 14

This only happens when the screen size is reduced.

Member

karmatosed commented Sep 4, 2017

After testing I have found the same FF issue:

2017-09-04 at 15 15

However, I can't replicate the other one.

Design wise I think if we can work out those issues, I would love to get this into 1.1. I am not sure this is perfect, but I would like to get user feedback on it and that's a great way to do it.

Collaborator

notnownikki commented Sep 4, 2017

I'm not entirely sure how to fix the FF wrapping issue... if anyone has a bit of spare time, I'd be happy to learn from them :)

notnownikki added some commits Sep 5, 2017

@notnownikki notnownikki Made the modal slightly wider to fix a wrap problem in FF 1330124
@notnownikki notnownikki Coding standard fix 02d0e6d
Collaborator

notnownikki commented Sep 5, 2017

I think I've addressed the issues here, it renders fine in chrome and firefox now, although I can't reproduce the issue where the settings close when you toggle a setting, and I can't see the design issue @youknowriad saw where all the link icons where wrapped onto the next line, no matter what browser I use.

Member

karmatosed commented Sep 5, 2017

Looks good to me, so going to merge.

@karmatosed karmatosed merged commit 64b0883 into master Sep 5, 2017

3 checks passed

codecov/project 31.56% (+0.14%) compared to 5885233
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@karmatosed karmatosed deleted the update/link-open-in-new-window branch Sep 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment