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

Enhancement: Tab to be set from outside, Keyboard navigation #741

Merged
merged 56 commits into from
Dec 19, 2023

Conversation

verena-ifx
Copy link
Contributor

@verena-ifx verena-ifx commented Nov 20, 2023

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description
Tab index can now be set from the outside;
Removed unnecessary code and added the updated Tab component to the Angular+React+Vue example apps
Keyboard navigation added

📦 Published PR as canary version: 20.37.0--canary.741.683712c531c460cfe5ac518ff3c3bae7a5eec2c0.0

✨ Test out this PR locally via:

npm install @infineon/infineon-design-system-stencil@20.37.0--canary.741.683712c531c460cfe5ac518ff3c3bae7a5eec2c0.0
# or 
yarn add @infineon/infineon-design-system-stencil@20.37.0--canary.741.683712c531c460cfe5ac518ff3c3bae7a5eec2c0.0

@verena-ifx verena-ifx added the minor minor version bump label Nov 20, 2023
@verena-ifx verena-ifx linked an issue Nov 20, 2023 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Nov 20, 2023

PR Preview Action v1.4.6
Preview removed because the pull request was closed.
2023-12-19 13:31 UTC

Copy link
Contributor

--STORYBOOK-PREVIEW--

@MichaelHolley
Copy link
Collaborator

Checked out the canary-build and as far as I can tell, the dynamic header-values and setActiveTab improvements work as expected. Looking forward to its merge 😃

@verena-ifx verena-ifx changed the title Enhancement: tabs bug fixed, and publuc method to set active tab from outside Enhancement: Tab to be set from outside, Keyboard navigation Nov 27, 2023
@tishoyanchev
Copy link
Contributor

Is this PR done?

@tishoyanchev
Copy link
Contributor

tishoyanchev commented Nov 30, 2023

General note:

  1. Let's avoid making overarching changes inside a PR dedicated to one particular issue. From the title, it seems like this PR is about the tab issue, and the keyboard navigation therefore refers only to the tabs, and yet changes are made to all components regarding keyboard navigation. Besides that, there are also changes to the scss. I think these changes should have been separate, and not inside this PR.
  2. Let's do more detailed descriptions. Not super detailed, but detailed enough so as to be clear by reading it what exactly is being changed and why.

@@ -23,18 +23,20 @@ export class Checkbox {
if (!this.disabled) {
if (this.inputElement.indeterminate) {
this.internalValue = true;
this.value = this.internalValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be reversed. You want to assign the value to the internalValue.

this.indeterminate = false;
} else {
this.internalValue = !this.internalValue;
this.value = this.internalValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. Assign the value to the internalValue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both need to be in sync, this is why.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if you need to reassign the value to the internalValue, then the value Prop has been changed externally, and therefore both will be synced by assigning the value to the internalValue.

@Watch('value')
valueChanged(newValue: boolean, oldValue: boolean) {
console.log("watch");
Copy link
Contributor

Choose a reason for hiding this comment

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

Did somebody forgot to remove the console.log? :)

packages/components/src/components/tabs/tabs.tsx Outdated Show resolved Hide resolved
// Reset to previously active tab
if (!this.tabObjects[prevActiveTab]?.disabled) {
this.internalActiveTabIndex = prevActiveTab;
this.activeTabIndex = prevActiveTab;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be internalActiveTabIndex.

packages/components/src/components/tabs/tabs.tsx Outdated Show resolved Hide resolved
packages/components/src/components/tabs/tabs.tsx Outdated Show resolved Hide resolved
@@ -52,38 +67,31 @@ export class IfxTabs {
// needed for smooth border transition
reRenderBorder() {
const borderElement = this.el.shadowRoot.querySelector('.active-border') as HTMLElement;
if (borderElement && this.tabHeaderRefs[this.activeTabIndex]) {
if (borderElement && this.tabHeaderRefs[this.internalActiveTabIndex]) {
if (this.orientation === 'horizontal') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest you add toLowerCase() in case they spell it with a capital letter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the orientation? didnt make changes to that and its configured on storybook via 2 options only. But we can add the lowerCase check.
Or do you mean the tabIndex? thats passed as a number, so shouldnt matter

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I was referring to the orientation prop. I can see people typing Horizontal with capital letter, and wondering why is it not working.

Copy link
Contributor

Choose a reason for hiding this comment

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

This one still remains unresolved. You can skip it if you want. It's a minor thing.

packages/components/src/components/tabs/tabs.tsx Outdated Show resolved Hide resolved
@verena-ifx
Copy link
Contributor Author

General note:

  1. Let's avoid making overarching changes inside a PR dedicated to one particular issue. From the title, it seems like this PR is about the tab issue, and the keyboard navigation therefore refers only to the tabs, and yet changes are made to all components regarding keyboard navigation. Besides that, there are also changes to the scss. I think these changes should have been separate, and not inside this PR.
  2. Let's do more detailed descriptions. Not super detailed, but detailed enough so as to be clear by reading it what exactly is being changed and why.

General note:

  1. Let's avoid making overarching changes inside a PR dedicated to one particular issue. From the title, it seems like this PR is about the tab issue, and the keyboard navigation therefore refers only to the tabs, and yet changes are made to all components regarding keyboard navigation. Besides that, there are also changes to the scss. I think these changes should have been separate, and not inside this PR.
  2. Let's do more detailed descriptions. Not super detailed, but detailed enough so as to be clear by reading it what exactly is being changed and why.

the majority of the other changes are simply replacing hard-coded tokens, but yes generally you are right, this should be done separately.

@verena-ifx
Copy link
Contributor Author

  1. On first page load, tab 1 is the first tab, tab 2 is the second tab, tab 3 is the content. But after that, if you click away, and then click tab key on the keyboard again, tab 1 is the first tab, tab 2 is the content. The tab 2 never gets focused again, not even with key right.
  2. Focus not working on React Javascript
  3. Cannot run on Vue-Javascript. Getting an error.

the keyboard navigation is not working with key navigation anymore, only with tabs. Focus is not working, I told you already

verena-ifx added 26 commits December 11, 2023 15:47
conuming wrapper components
conuming wrapper components
@tishoyanchev tishoyanchev merged commit d2d1e67 into master Dec 19, 2023
8 checks passed
Copy link
Contributor

🚀 PR was released in v20.37.0 🚀

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

Successfully merging this pull request may close these issues.

Tabs: Set Active tab from the outside
3 participants