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

Navigation: Try adding Links block #24644

Closed
noisysocks opened this issue Aug 19, 2020 · 5 comments
Closed

Navigation: Try adding Links block #24644

noisysocks opened this issue Aug 19, 2020 · 5 comments
Assignees
Labels
[Block] Navigation Affects the Navigation Block New Block Suggestion for a new block [Status] In Progress Tracking issues with work in progress

Comments

@noisysocks
Copy link
Member

Currently, if you add a Search block to a Navigation block, this is the resultant markup displayed on the frontend:

<nav class="wp-block-navigation">
   <ul class="wp-block-navigation__container">
      <li class="wp-block-navigation-link"><a class="wp-block-navigation-link__content" href="/"><span class="wp-block-navigation-link__label">Home</span></a></li>
      <li class="wp-block-navigation-link"><a class="wp-block-navigation-link__content" href="/about"><span class="wp-block-navigation-link__label">About</span></a></li>
      <form role="search" method="get" action="http://localhost:8888/" class="wp-block-search"><label for="wp-block-search__input-2" class="wp-block-search__label">Search</label><input type="search" id="wp-block-search__input-2" class="wp-block-search__input" name="s" value="" placeholder="" required><button type="submit" class="wp-block-search__button">Search</button></form>
   </ul>
</nav>

Note that form appears within the ul which is invalid HTML.

The accessibility advice is that only links should appear within a navigation's ul. Other blocks should render within the nav.

To do implement this, let's explore adding a intermediary Links block which:

  • Renders a ul around its inner blocks.
  • Allows only Link as a child.
  • Allows only Navigation as a parent.

When adding a Navigation, a Links block should already be added so as to minimise the number of clicks needed for a user to add a Link to a Navigation.

There is some previous exploration of this in the try/split-navigation-links-out-of-navigation branch.

See previous discussion in #24364 and #23915 for more context.

@noisysocks noisysocks added the [Block] Navigation Affects the Navigation Block label Aug 19, 2020
@noisysocks noisysocks added the Needs Design Feedback Needs general design feedback. label Aug 19, 2020
@noisysocks
Copy link
Member Author

@talldan: I think this is where we landed. Does it sound right to you?

@shaunandrews: Any thoughts on minimising the user impact here?

@shaunandrews
Copy link
Contributor

Any thoughts on minimising the user impact here?

Only that I wouldn't expect a user to have to understand any of these details; I'm not sure any of this should be exposed in the UI.

@shaunandrews shaunandrews removed the Needs Design Feedback Needs general design feedback. label Aug 26, 2020
@noisysocks
Copy link
Member Author

I think that we're forced to implement a container Links block because:

I agree that a container Links block is not an ideal user experience 😞

@draganescu
Copy link
Contributor

I will move this to Needs Dev as the direction from Shaun is clear to expose in the UI as little as possible from this support "container" block.

@tellthemachines
Copy link
Contributor

Now that #30551 has been merged, we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block New Block Suggestion for a new block [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants