Skip to content

Conversation

@NHristov-sap
Copy link
Contributor

@NHristov-sap NHristov-sap commented Nov 22, 2024

There is a request for redesign/refactoring of AI Button ui5-ai-button in order to use ui5-split-button instead of ui5-button which will allow app developers to define default action on pressing of AI button and opening an additional menu in some cases.

image

There is new property splitMode introduced in ui5-button-state component that activates split button mode for specific state.

Copy link
Contributor

@hinzzx hinzzx left a comment

Choose a reason for hiding this comment

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

We could also add a playground sample and a test maybe.
For example we can test that it changes successfully to split-button mode, when clicking Generate

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.

Hi, made some suggestions. Was not sure whether some of the instructions are intended for the developer, or for the end user. For example in lines 35 to 37 my assumption is that instruction is intended for developer, although some parts can be interpreted as intended for end user.

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 editing the capitalization for button names, as suggested in the comments.

@NHristov-sap NHristov-sap requested review from Stoev and hinzzx December 17, 2024 13:52
* Each state have a name that identifies it and can have text, icon and end icon defined (in any combination) depending on the state purpose.
* For the `ui5-ai-button` user interface, you can define one or more button states by placing `ui5-ai-button-state` components in their default slot.
* Each state has a name for identification and can include text, an icon, and an end icon, as needed for its purpose.
* You can define a split mode for the `ui5-ai-button`, which will results in displaying an arrow button for additional actions.
Copy link

Choose a reason for hiding this comment

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

Please change:

You can define a split mode for the ui5-ai-button, which will results in displaying an arrow button for additional actions.

To:

You can define a split mode for the ui5-ai-button, which will result in displaying an arrow button for additional actions.

* It enables users to trigger actions by clicking or tapping the `ui5-ai-button`, or by pressing
* certain keyboard keys, such as Enter.
* The `ui5-ai-button` component serves as a button for AI-related scenarios. Users can trigger actions by clicking or tapping the `ui5-ai-button`
* or by pressing keyboard keys like [Enter] or [Space].
Copy link

Choose a reason for hiding this comment

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

Please consider changing:

Users can trigger actions by clicking or tapping the ui5-ai-button

To:

Users can trigger actions by choosing the ui5-ai-button

* The `ui5-ai-button` can be activated by clicking or tapping it. You can change the button state in the click event handler. When the button is
* in split mode, you can activate the default button action by clicking or tapping it, or by pressing keyboard keys like [Enter] or [Space].
* You can activate the arrow button by clicking or tapping it, or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4].
* To display additional actions, you can attach a menu to the arrow button.
Copy link

Choose a reason for hiding this comment

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

Please consider changing for accessibility purpose:

The ui5-ai-button can be activated by choosing it. You can change the button state in the click event handler. When the button is in split mode, you can activate the default button action by choosing it or by pressing keyboard keys like [Enter] or [Space]. You can activate the arrow button by choosing it or by pressing keyboard keys like [Arrow Up], [Arrow Down], or [F4]. To display additional actions, you can attach a menu to the arrow button.

* Fired when the component is in split mode and after the arrow button
* is activated either by clicking or tapping it or by using the [Arrow Up] / [Arrow Down],
* [Alt] + [Arrow Up]/ [Arrow Down], or [F4] keyboard keys.
* @public
Copy link

Choose a reason for hiding this comment

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

Please consider changing:

аctivated either by clicking or tapping it

to:

аctivated by choosing it

@NHristov-sap NHristov-sap requested review from ivtasev and vladitasev and removed request for ivtasev December 19, 2024 12:47
Copy link
Contributor

@vladitasev vladitasev left a comment

Choose a reason for hiding this comment

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

Important: This is just a review of the public APIs

I see 2 issues:

  • The names of the new APIs are inconsistent

ai-button: activeArrowButton + arrow-click event
ai-button-state: splitMode

There is no way for the user to understand that these 3 are related and affect the same UI element (the arrow to the right)

Here are a couple of possibilities:

ai-button: arrowButtonActive + arrow-button-click event
ai-button-state: showArrowButton

or

ai-button: arrowActive + arrow-click event
ai-button-state: showArrow

  1. I believe "active" is not the correct term for the pressed state of the arrow. Active means that the user can interact with it. Probably should be "pressed" - this is how it is in ui5-toggle-button

Therefore, my final suggestion would be:

ai-button: arrowButtonPressed + arrow-button-click event
ai-button-state: showArrowButton

This way it should be easier for app developers to connect the dots - they can set showArrowButton on the states, then they can set arrowButtonPressed on the ai button itself, and when the user clicks it the event that is fired is arrowButtonClick

@property({ type: Boolean })
fadeOut = false;
@property({ type: Boolean, noAttribute: true })
activeArrowButton = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Must be arrowButtonActive (boolean property names end with an adjective)

* @public
*/
@property({ type: Boolean })
splitMode = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should be called showArrowButton because splitMode means nothing for people who haven't seen the specs/figmas and is more like designer slang IMO

@Stoev
Copy link

Stoev commented Dec 20, 2024 via email

@NHristov-sap NHristov-sap merged commit 55c9e4d into main Dec 20, 2024
10 checks passed
@vladitasev vladitasev deleted the BL_aibutton_split branch December 20, 2024 09:12
@ui5-webcomponents-bot
Copy link
Collaborator

🎉 This PR is included in version v2.6.0-rc.3 🎉

The release is available on v2.6.0-rc.3

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants