weixin_39905695
weixin_39905695
2020-12-09 09:36

Try/menu descriptions

Fixes #414

Summary

Adds the description to menu items.

In the screenshot I'm including items with and without descriptions as well as short/long titles/descriptions to get an idea of the alignments.

Screenshot_2020-10-12 Lorem Ipsum – My Blog

Test instructions

This PR can be tested by following these steps: 1. Add descriptions to menu items 1. Check out the front-end.

Quality assurance

  • [x] I have thought about any security implications this code might add.
  • [x] I have checked that this code doesn't impact performance (greatly).
  • [x] I have tested this code to the best of my abilities
  • [x] I have checked that this code does not affect the accessibility negatively

该提问来源于开源项目:WordPress/twentytwentyone

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

8条回答

  • weixin_39535349 weixin_39535349 5月前

    Responsive view:

    responsive-description

    Hover: hover-description

    Focus: focus-description

    点赞 评论 复制链接分享
  • weixin_39809168 weixin_39809168 5月前

    Technical question: does the description have to be a part of the navigation link?

    点赞 评论 复制链接分享
  • weixin_39905695 weixin_39905695 5月前

    Technical question: does the description have to be a part of the navigation link?

    If inside the twenty_twenty_one_add_menu_description_args function I change $args->link_after to $args->after, the description is no longer part of the link. The problem with that, is that the HTML & CSS will get more complicated - specifically for menus that have children. If we go that route, we'll need to play a lot with positioning etc to make sure that buttons stay where they should, and descriptions go below them (the problem is the dropdown buttons positioning)

    点赞 评论 复制链接分享
  • weixin_39905695 weixin_39905695 5月前

    One question: It doesn't look like descriptions are showing up for subnav items. Is that expected? (I've never used this feature in WP myself, so I'm not sure smile).

    Yeah, that is expected. We can add them to submenus if we want to (just have to remove the 0 === $depth condition from https://github.com/WordPress/twentytwentyone/pull/424/files#diff-3f4057e51a7f16fbb630eef28a9d80450ce21e41ea71c5091567e003334f90fcR51), but I don't think I've ever seen descriptions used in submenus...

    点赞 评论 复制链接分享
  • weixin_39627361 weixin_39627361 5月前

    Cool, I'm happy to leave them out in that case. 👍

    点赞 评论 复制链接分享
  • weixin_39809168 weixin_39809168 5月前

    I know this is merged, but it is possible to instead remove the active/hover effect on just the description? (We'd leave the focus the same)

    点赞 评论 复制链接分享
  • weixin_39905695 weixin_39905695 5月前

    I know this is merged, but it is possible to instead remove the active/hover effect on just the description? (We'd leave the focus the same)

    PR #509

    点赞 评论 复制链接分享
  • weixin_39905695 weixin_39905695 5月前

    as discussed on the team meeting, pinging you for feedback. This was a quick proof of concept, we can tweak the styles. :+1:

    点赞 评论 复制链接分享

相关推荐