-
Notifications
You must be signed in to change notification settings - Fork 274
feat(ui5-multiinput, ui5-multi-combobox): implement keyboard handling #2166
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
Merged
ilhan007
merged 4 commits into
SAP:master
from
ivoplashkov:multiinput-multicombobox-keyboard-handling
Sep 4, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; | |
import { getTheme } from "@ui5/webcomponents-base/dist/config/Theme.js"; | ||
import { | ||
isBackSpace, | ||
isEnter, | ||
isSpace, | ||
isDelete, | ||
} from "@ui5/webcomponents-base/dist/Keys.js"; | ||
|
@@ -52,6 +51,20 @@ const metadata = { | |
* @private | ||
*/ | ||
overflows: { type: Boolean }, | ||
|
||
/** Defines whether the <code>ui5-token</code> is selected or not. | ||
* | ||
* @type {boolean} | ||
* @public | ||
*/ | ||
selected: { type: Boolean }, | ||
|
||
/** | ||
* Defines the tabIndex of the component. | ||
* @type {string} | ||
* @private | ||
*/ | ||
_tabIndex: { type: String, defaultValue: "-1", noAttribute: true }, | ||
}, | ||
|
||
events: /** @lends sap.ui.webcomponents.main.Token.prototype */ { | ||
|
@@ -70,6 +83,14 @@ const metadata = { | |
"delete": { type: Boolean }, | ||
}, | ||
}, | ||
|
||
/** | ||
* Fired when the a <code>ui5-token</code> is selected by user interaction with mouse or clicking space. | ||
* | ||
* @event | ||
* @public | ||
*/ | ||
select: {}, | ||
}, | ||
}; | ||
|
||
|
@@ -114,10 +135,10 @@ class Token extends UI5Element { | |
this.i18nBundle = getI18nBundle("@ui5/webcomponents"); | ||
} | ||
|
||
_select() { | ||
_handleSelect() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should fire an event both cases - when the user selects and unselects a token. So, _handleEvent and _select can be combined in one: this.selected = !this.selected;
this.fireEvent("select"); I saw that we have such event name in the RadioButton already. In the CheckBox we have "change", let's keep it "select" for now. |
||
this.selected = !this.selected; | ||
this.fireEvent("select"); | ||
this.selected = true; | ||
} | ||
} | ||
|
||
_delete() { | ||
this.fireEvent("delete"); | ||
|
@@ -136,9 +157,10 @@ class Token extends UI5Element { | |
}); | ||
} | ||
|
||
if (isEnter(event) || isSpace(event)) { | ||
this.fireEvent("select", {}); | ||
this.selected = true; | ||
if (isSpace(event)) { | ||
event.preventDefault(); | ||
|
||
this._handleSelect(); | ||
} | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialize the flag in the constructor and explain what is needed for in a comment