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

feat: Menu refactor to Fiori3 #702

Merged
merged 12 commits into from Mar 29, 2020
Merged

feat: Menu refactor to Fiori3 #702

merged 12 commits into from Mar 29, 2020

Conversation

kavya-b
Copy link
Contributor

@kavya-b kavya-b commented Feb 25, 2020

Related Issue

Closes #571

Description

Update Menu styles, documentation and tests to align with Fiori3 specs

  • removed fd-menu__group classes, their playground tests and documentation examples related to group headers.
  • added new classes for compact and mobile modes: fd-menu--compact and fd-menu--mobile. Default will be cozy tablet mode.
  • moved fd-menu__item--separated from <ul> level to its own element fd-menu__separator in a <span> since separators are now used instead of group headers to show grouping.
  • using existing class fd-menu__title for the text that will be used in a <span>
  • added new class for secondary icon fd-menu__addon-after that will be used similar to fd-menu__addon-before
  • added a modifier class for the affordance arrow when used in a submenu fd-menu__addon-after--submenu to get the right(or left in RTL) navigation arrow in a smaller icon size.
  • added new class for submenu fd-menu__sublist at the <ul> level corresponding to fd-menu__list of the parent menu.
  • added new class fd-menu__link that wraps the item name and associated icons, if any.
  • added new class has-child that can be applied on the parent __link class to apply styles for the parent element that has a submenu.
  • moved fd-menu__item class to the parent <li> tag.

Breaking changes

  • Removed fd-menu__item--separated. Instead use fd-menu__separator in its own <span> after the <li> item where you want the separator.
  • Removed fd-menu__group. Separator itself acts a visual cue for grouping.
  • Removed fd-menu--addon-before(not fd-menu__addon-before) as it is unnecessary now and will be covered by existing classes.
  • Moved fd-menu__item class to the parent <li> tag. Use fd-menu__link class on the <a> tag instead.

For new classes added, please refer to the above section.

Screenshots

NOTE: If you've made any style changes, please provide appropriate screenshots (before and after) to help reviewers.

To see examples of which screenshots to include, go to Screenshot Examples.

Before:

image
image

After:

image
image

Updated screenshots:

image

image

@netlify
Copy link

netlify bot commented Feb 25, 2020

Deploy preview for fundamental-styles ready!

Built with commit ee0c701

https://deploy-preview-702--fundamental-styles.netlify.com

@kavya-b kavya-b added the Fiori 3 refactoring match Fiori 3 requirements label Feb 26, 2020
@kavya-b kavya-b self-assigned this Feb 26, 2020
@kavya-b kavya-b force-pushed the feat/menu-fiori3-refactor branch 2 times, most recently from 9557f63 to 345c251 Compare February 27, 2020 05:39
Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

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

  • Let's add cozy mode by default, because right now there is only compact mode.

  • There are also differencted between Compact/Cozy(tablet)/Cozy(Phone)
    image

  • Background color of fd-menu is not set

  • Remove underline from <a> if used with __title
    image

src/menu.scss Outdated Show resolved Hide resolved
src/menu.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

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

Let's remove some of unused/useless properties. They can cause some issues in future. Please also test the changes on IE11, which has to be supported as well.

src/menu.scss Outdated Show resolved Hide resolved
src/menu.scss Outdated Show resolved Hide resolved
src/menu.scss Outdated Show resolved Hide resolved
src/menu.scss Outdated Show resolved Hide resolved
src/menu.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@rengare rengare left a comment

Choose a reason for hiding this comment

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

The menu item has text decorator this doesn't match fiori 3

image

wrong width in IE 11

image

Could you add RTL example to documentation?

@kavya-b
Copy link
Contributor Author

kavya-b commented Feb 27, 2020

The menu item has text decorator this doesn't match fiori 3

image

This is coming from the styles <a> tag in documentation itself. It appears fine in playground:
image
Currently same thing is happening for side-navigation component as well.

wrong width in IE 11

image

I will work on this; however, in the meanwhile, do you think this is related to #691 ?

Could you add RTL example to documentation?

I will add this.

@kavya-b
Copy link
Contributor Author

kavya-b commented Feb 27, 2020

  • Let's add cozy mode by default, because right now there is only compact mode.

Do you mean, I should have the cozy mode applied by default? But for desktop, it is mentioned as Compact mode, right?

  • There are also differencted between Compact/Cozy(tablet)/Cozy(Phone)
    image

Currently, the styles of cozy, compact are applied when the screen is resized. However, from your other comment, it seems that these styles are better provided as separate fd-menu-cozy fd-menu-compact classes. I will work on changing this.

  • Background color of fd-menu is not set

I assumed that since fd-menu will be part of a popover, the background color, box shadow and border attributes of the container should be part of the popover. I have verified that the appropriate values are applied to the popover class.

  • Remove underline from <a> if used with __title
    image

This is coming from the styles <a> tag in documentation itself. It appears fine in playground:
image
Currently same thing is happening for side-navigation component as well.

@rengare
Copy link
Contributor

rengare commented Feb 28, 2020

I will work on this; however, in the meanwhile, do you think this is related to #691 ?
Frankly, I don't know, we know that it is due to the popover and input used together but maybe it is related. I would have to check that

@CLAassistant
Copy link

CLA assistant check
All committers have signed the CLA.

@kavya-b kavya-b force-pushed the feat/menu-fiori3-refactor branch 2 times, most recently from 299019b to 95240e2 Compare March 4, 2020 03:57
@kavya-b
Copy link
Contributor Author

kavya-b commented Mar 4, 2020

There are 2 known issues in IE as of now that I couldn’t find a fix for but I also see the same issue is present in components that use List component(Select, Multi Input etc)-

  1. focus border outline-offset property is not applied properly in IE due to which it sometimes does not appear properly
  2. clicking on the parent <li> area alone activates the states (active, selected etc). If you click on an area that is a child of <li> the states don’t show up.

@stefanoScalzo
Copy link
Contributor

Screen Shot 2020-03-04 at 8 05 15 PM
disabled should not change color on hover and on click

@kavya-b
Copy link
Contributor Author

kavya-b commented Mar 5, 2020

Screen Shot 2020-03-04 at 8 05 15 PM
disabled should not change color on hover and on click

fixed

Copy link
Contributor

@JKMarkowski JKMarkowski left a comment

Choose a reason for hiding this comment

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

Hello @kavya-b, please take a look at this comment, Rest looks good for me.

src/menu.scss Outdated

display: block;
display: flex;
align-items: center;
transition: all $fd-animation-speed ease-in;
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no mention about transition in menu specs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed this. Will remove it, thanks for pointing it out!

@droshev
Copy link
Contributor

droshev commented Mar 18, 2020

@kavya-b thanks for the updates.
Could you try to review your component following the points from https://github.com/SAP/fundamental-styles/wiki/Self-Contained-Styles. There is something wrong with the separator:
Screen Shot 2020-03-18 at 2 31 03 PM

@kavya-b
Copy link
Contributor Author

kavya-b commented Mar 19, 2020

https://github.com/SAP/fundamental-styles/wiki/Self-Contained-Styles

Hi @droshev, I tried to figure out if I am missing something that makes the unnormalized mode look like that, but cannot point to anything.
fd-menu__separator is in its own element in order to cover the edge case where we have a selected item and also need to show the separator, as pointed by @InnaAtanasova in this comment: #702 (review)

Update:
Although by specifying it as an element rather than a modifier(using __separator rather than --separator, I see that this unnormalized behavior is fixed only if I specify fd-menu fd-menu__separator in my .njk file:
image
I do not quite understand why this is happening, as by itself it works just fine in the documentation pages. However, for the tests I will be providing it like the aforementioned fix.

@droshev
Copy link
Contributor

droshev commented Mar 22, 2020

@kavya-b We need to check how the nested menu behaves and looks on mobile. I guess it may behave like the nested list in side navigation. Can you follow up on that?
Meanwhile i fixed the self-contained issue I had raised before.

@kavya-b
Copy link
Contributor Author

kavya-b commented Mar 23, 2020

@kavya-b We need to check how the nested menu behaves and looks on mobile. I guess it may behave like the nested list in side navigation. Can you follow up on that?

Hi @droshev , the spec says "On Phone the Submenu opens in a new page, leaving the Menu option behind. " The same visual design will apply for the submenu; on clicking of the parent item, the submenu will open in the same dialog, replacing the parent menu options, and the device's back button will bring it back to the parent menu.
Does this need to be added to the documentation? I am not sure how to show a full screen replacement of parent menu in the same example using only aria-controls. I have something like this now:
image
Please let me know if this suffices, I will push in the changes.

Meanwhile i fixed the self-contained issue I had raised before.

Thank you for this.

@kavya-b
Copy link
Contributor Author

kavya-b commented Mar 26, 2020

@droshev As discussed, the documentation for mobile mode has been modified to reflect full screen:
submenu_mobile

@droshev droshev self-requested a review March 27, 2020 01:43
Copy link
Contributor

@droshev droshev 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 to me! good work

@kavya-b kavya-b dismissed droshev’s stale review March 27, 2020 03:29

addressed all changes requested

@kavya-b kavya-b added this to PRs Review in progress in Development via automation Mar 27, 2020
@kavya-b kavya-b dismissed InnaAtanasova’s stale review March 27, 2020 03:30

addressed all changes requested

Development automation moved this from PRs Review in progress to PRs Reviewer approved Mar 27, 2020
kavya-b and others added 12 commits March 27, 2020 09:01
…bile mode

- keeping tablet cozy as the default
- added rtl example
- fixed IE submenu width issue
- changed option-name to title
- removed float usage
- provided examples for cozy, compact and mobile mode
- updated screenshots, tests, documentation
replaced <a> tag with <span> tag
-removing redundant span container tag and moving fd-menu__item to li tag instead- for submenu though it has to have its parent menu item in its own span so that parent's states do not override submenu states
-added role and tabindex to show tab order and focus
added fd-fiori-focus() new function instead of defining in menu.scss- uses inner focus instead of outer focus
-updated playground
- removed redundant right-arrow icons when submenu was not reeally present
- instead used other icons to showcase secondary icon size
- using separator in a different element
- removed 'desktop' from modifier class name
- removed transition property
- applied font-size on icon directly
- updated playground tests and screenshots accordingly - added selected-separated usecase to visual test
Renamed to fd-menu__separator
modified playground test and documentation
removed comment from code
added description  and usage of classes to documentation
removed hybrid usage of icons and long text from documentation, keeping it consistent, all these combinations are already preseent in playground
added breaking changes to pr description
-added link class to aid implementation and support accessibility per aria standards.
-added some aria attributes
-modified playground test and documentation to support above changes
-also added is-selected mode and right/left arrow automatically on has-child class
-using --submenu modifier on addon-after element will add the right arrow by default, if custom icon needs to be added, one can use it same as addon-before element without --submenu modifier.
-updated playground tests and documentation to reflect these changes
@droshev droshev merged commit 1272053 into master Mar 29, 2020
Development automation moved this from PRs Reviewer approved to Done Mar 29, 2020
@droshev droshev deleted the feat/menu-fiori3-refactor branch March 29, 2020 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fiori 3 refactoring match Fiori 3 requirements
Projects
Development
  
Done
Development

Successfully merging this pull request may close these issues.

Refactor Menu to match Fiori 3 specs and the sap-theming
8 participants