Skip to content

Commit a77c2d4

Browse files
authored
Merge branch 'master' into issue.2857
2 parents b290c22 + 42dd2af commit a77c2d4

File tree

7 files changed

+28
-23
lines changed

7 files changed

+28
-23
lines changed

package-lock.json

Lines changed: 7 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
"@carbon/icons": "11.14.0",
144144
"@carbon/utils-position": "1.1.4",
145145
"@floating-ui/dom": "1.6.3",
146-
"@ibm/telemetry-js": "^1.2.1",
146+
"@ibm/telemetry-js": "^1.5.0",
147147
"flatpickr": "4.6.13",
148148
"tslib": "2.3.0"
149149
}

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ gulp buildMeta
1616
# generate ALL the documentation
1717
mkdir dist/docs
1818
npm run build-storybook
19-
npm run docs:build && mv documentation dist/docs/
19+
npm run docs:build && mv documentation dist/docs/ && mv telemetry.yml dist/telemetry.yml

src/dropdown/list/dropdown-list.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ export class DropdownList implements AbstractDropdownView, AfterViewInit, OnDest
352352
}
353353
}
354354

355-
return elemList[this.index].nativeElement;
355+
return elemList[this.index]?.nativeElement;
356356
}
357357

358358
/**
@@ -490,6 +490,7 @@ export class DropdownList implements AbstractDropdownView, AfterViewInit, OnDest
490490
updateIndex() {
491491
// initialize index on the first selected item or
492492
// on the next non disabled item if no items are selected
493+
// in case, if all items are disabled, the index value will remain same
493494
const selected = this.getSelected();
494495
if (selected.length) {
495496
this.index = this.displayItems.indexOf(selected[0]);
@@ -513,7 +514,7 @@ export class DropdownList implements AbstractDropdownView, AfterViewInit, OnDest
513514
event.preventDefault();
514515
if (event.key === "ArrowDown") {
515516
if (this.hasNextElement()) {
516-
this.getNextElement().scrollIntoView({ block: "end" });
517+
this.getNextElement()?.scrollIntoView({ block: "end" });
517518
} else {
518519
this.blurIntent.emit("bottom");
519520
}

src/ng-package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"@carbon/utils-position",
99
"@carbon/icon-helpers",
1010
"@carbon/icons",
11-
"@carbon/telemetry",
12-
"@floating-ui/dom",
13-
"flatpickr"
11+
"@floating-ui/dom",
12+
"@ibm/telemetry-js",
13+
"flatpickr"
1414
]
1515
}

src/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "[email protected]:carbon-design-system/carbon-components-angular.git"
99
},
1010
"scripts": {
11-
"postinstall": "carbon-telemetry collect --install"
11+
"postinstall": "ibmtelemetry --config=telemetry.yml"
1212
},
1313
"license": "Apache-2.0",
1414
"author": "IBM",
@@ -18,9 +18,9 @@
1818
"dependencies": {
1919
"@carbon/icon-helpers": "10.37.0",
2020
"@carbon/icons": "11.14.0",
21-
"@carbon/telemetry": "0.1.0",
2221
"@carbon/utils-position": "1.1.4",
2322
"@floating-ui/dom": "1.6.3",
23+
"@ibm/telemetry-js": "^1.5.0",
2424
"flatpickr": "4.6.13",
2525
"tslib": "2.3.0"
2626
}

src/tooltip/tooltip.component.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ export class Tooltip extends PopoverContainer implements AfterContentChecked {
7272
/**
7373
* Optional data for templates passed as implicit context
7474
*/
75-
@Input() templateContext: any
75+
@Input() templateContext: any;
7676

7777
@ViewChild("contentWrapper") wrapper: ElementRef<HTMLSpanElement>;
7878

79+
private timeoutId: any; // it should be number, but setTimeout below is matching the NodeJs type instead of the JS type
80+
7981
constructor(
8082
protected elementRef: ElementRef,
8183
protected ngZone: NgZone,
@@ -89,14 +91,20 @@ export class Tooltip extends PopoverContainer implements AfterContentChecked {
8991

9092
@HostListener("mouseenter", ["$event"])
9193
mouseenter(event) {
92-
setTimeout(() => {
94+
// If a mouseleave is triggered before the tooltip is displayed (before setTimeout of mouseenter completes)
95+
// we trigger the mouseleave only avoiding having to unecessary show the tooltip
96+
clearTimeout(this.timeoutId);
97+
this.timeoutId = setTimeout(() => {
9398
this.handleChange(true, event);
9499
}, this.enterDelayMs);
95100
}
96101

97102
@HostListener("mouseleave", ["$event"])
98103
mouseleave(event) {
99-
setTimeout(() => {
104+
// If a mouseleave is triggered before the tooltip is displayed (before setTimeout of mouseenter completes)
105+
// we trigger the mouseleave only avoiding having to unecessary show the tooltip
106+
clearTimeout(this.timeoutId);
107+
this.timeoutId = setTimeout(() => {
100108
this.handleChange(false, event);
101109
}, this.leaveDelayMs);
102110
}

0 commit comments

Comments
 (0)