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(ui5-side-navigation): add actions and unselectable items #10482

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

dimovpetar
Copy link
Contributor

BGSOFUIRODOPI-3344

@dimovpetar dimovpetar marked this pull request as draft January 7, 2025 13:27
@dimovpetar dimovpetar marked this pull request as ready for review January 14, 2025 08:25
@dimovpetar dimovpetar changed the title feat(ui5-side-navigation): add actions and option to select leaves only feat(ui5-side-navigation): add actions and unselectable items Jan 14, 2025
@dimovpetar dimovpetar requested review from a team and Stoev January 14, 2025 14:13
Copy link

@Stoev Stoev left a comment

Choose a reason for hiding this comment

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

As tentative suggestion please consider changing summary sentence "feat(ui5-side-navigation): add actions and unselectable items #10482" to "feat(ui5-side-navigation): adds actions and unselectable items #10482".

Reason for suggestion proposal is: https://github.com/SAP/openui5/blob/master/docs/guidelines/jsdoc.md - JSDoc Guidelines: "For actions, start directly with an appropriate verb in the third person: Adds, allocates, constructs, converts, deallocates, destroys, gets, provides, reads, removes, represents, returns, sets, saves, and so on".

packages/fiori/src/SideNavigationSelectableItemBase.ts Outdated Show resolved Hide resolved
packages/fiori/src/SideNavigationSelectableItemBase.ts Outdated Show resolved Hide resolved
Default = "Default",

/**
* Design for items that perform an action, such as opening a dialog.
Copy link

Choose a reason for hiding this comment

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

Please consider as alternative:
Design for items that trigger an action,

Just a thought: would it be helpful to state that these items should not contain child items?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, sounds better. Please check again

@dimovpetar
Copy link
Contributor Author

As tentative suggestion please consider changing summary sentence "feat(ui5-side-navigation): add actions and unselectable items #10482" to "feat(ui5-side-navigation): adds actions and unselectable items #10482".

Reason for suggestion proposal is: https://github.com/SAP/openui5/blob/master/docs/guidelines/jsdoc.md - JSDoc Guidelines: "For actions, start directly with an appropriate verb in the third person: Adds, allocates, constructs, converts, deallocates, destroys, gets, provides, reads, removes, represents, returns, sets, saves, and so on".

This is the guideline that applies here https://sap.github.io/ui5-webcomponents/docs/contributing/conventions-and-guidelines/#commit-description. It should be in imperative present tense.

@dimovpetar dimovpetar requested a review from Stoev January 20, 2025 08:14
<%COMPONENT_METADATA%>
Copy link
Contributor

Choose a reason for hiding this comment

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

Update the existing sample to include the following:

  • all external links must be "unselectable". Also please check the "NavigationLayout" sample and do the same
  • better to put the external links in the fixed items area, as those are the guidelines
  • add several parent elements which are not selectable. Or even better, make a new sample where all parents are unselecatable - as the guideline is to use only selectable or only unselectable parent items in the same side nav

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • done
  • done
  • TODO - add new sample

if (this.unselectable) {
this._toggle();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Quick action can not be triggered by pressing "Enter". It is only triggered by click or pressing "Space"
On other hand if you put "unselectable" on an external link it is triggered by "Enter" but not by "Space"
Also add a test for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unselectable items are now also activated by Enter.
Please open separate issue that external links are not opened with Space. It is working like that on the master branch too.

packages/fiori/src/SideNavigationItem.ts Outdated Show resolved Hide resolved
*
*
* **Guidelines**:
* - External links should not be unselectable
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "not". Text should say "External links should be unselectable"

@property()
design: `${SideNavigationItemDesign}` = "Default";

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

@Stoev please re-check this part of the documentation as it was significantly changed.

@@ -201,6 +225,12 @@ class SideNavigationItem extends SideNavigationSelectableItemBase {
get isSideNavigationItem() {
return true;
}

_toggle() {
Copy link
Contributor

Choose a reason for hiding this comment

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

In ui5-side-navigation, in collapsed mode - go to a single click area parent, open the menu with children - press enter or space on the first item (this would be the parent itself) - menu closes. Next time when you open the menu - the child items are gone

Copy link

@Stoev Stoev left a comment

Choose a reason for hiding this comment

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

please consider some suggestions.

*
* **Guidelines**:
* - External links should not be unselectable
* - Items that trigger actions (with design "Action") should be unselectable
Copy link

Choose a reason for hiding this comment

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

Please place a full stop:
unselectable.

* Indicates whether the navigation item is selectable. By default all items are selectable unless specifically marked as unselectable.
*
* When a parent item is marked as unselectable, clicking it will only expand or collapse its sub-items.
* To achieve better user experience you should not mix unselectable parent items and selectable parent items in the same side navigation.
Copy link

Choose a reason for hiding this comment

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

Please consider simplifying, for example:
To improve user experience do not mix unselectable parent items with selectable parent items in a single side navigation.

design: `${SideNavigationItemDesign}` = "Default";

/**
* Indicates whether the navigation item is selectable. By default all items are selectable unless specifically marked as unselectable.
Copy link

Choose a reason for hiding this comment

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

Would it add value for the reader if the term here is more accurate: instead of 'navigation item' we use 'ui5-side-navigation-item'?

/**
* Indicates whether the navigation item is selectable. By default all items are selectable unless specifically marked as unselectable.
*
* When a parent item is marked as unselectable, clicking it will only expand or collapse its sub-items.
Copy link

Choose a reason for hiding this comment

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

Please consider avoiding the verb "click" whenever possible: (https://help.sap.com/docs/SNG_FOR_UA/e33c591ae4494a659a3f5f983c9d1161/80cf1399d10b47b482e833b6dbe9211c.html?state=DRAFT&q=accessability):

When a parent item is marked as unselectable, selecting it will only expand or collapse its sub-items.

import type SideNavigationItemDesign from "./types/SideNavigationItemDesign.js";
import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";

type SideNavigationItemAccessibilityAttributes = Pick<AccessibilityAttributes, "hasPopup">;

/**
* Fired when the component is activated either with a
Copy link

Choose a reason for hiding this comment

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

Is this sentence incomplete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants