Skip to content

Commit 2c82167

Browse files
committed
fix: fix issue with widget not selecting place
The issue with the widget not selecting a place was due to the event listener on blur. The blur event was happening before the "combobox-commit" event which is the one that sets the place. A fix for this was to add event listener to the `mousedown` event instead of the `click` event in the combobox code. That was solved with a patch using `patch-package`. Also mentioned in this issue: github/combobox-nav#54 Also fixed an issue that showed "undefined" if selected place did not have a locality.
1 parent 39727ba commit 2c82167

19 files changed

+4116
-45
lines changed

Diff for: package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@atb-as/planner-web",
3-
"version": "2.6.0",
3+
"version": "2.8.0",
44
"private": true,
55
"license": "EUPL-1.2",
66
"scripts": {
@@ -18,7 +18,8 @@
1818
"generate": "graphql-codegen",
1919
"prestart": "yarn generate",
2020
"predev": "yarn generate",
21-
"generate-widget-version": "sh ./scripts/build-widget.sh"
21+
"generate-widget-version": "sh ./scripts/build-widget.sh",
22+
"postinstall": "patch-package"
2223
},
2324
"dependencies": {
2425
"@apollo/client": "^3.8.8",
@@ -82,6 +83,8 @@
8283
"graphql-tag": "^2.12.6",
8384
"happy-dom": "^12.10.3",
8485
"next-router-mock": "^0.9.10",
86+
"patch-package": "^8.0.0",
87+
"postinstall-postinstall": "^2.1.0",
8588
"prettier": "^3.1.1",
8689
"rimraf": "^5.0.1",
8790
"typescript": "5.3.3",

Diff for: patches/@github+combobox-nav+2.3.0.patch

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/node_modules/@github/combobox-nav/dist/index.js b/node_modules/@github/combobox-nav/dist/index.js
2+
index d86de71..3956688 100644
3+
--- a/node_modules/@github/combobox-nav/dist/index.js
4+
+++ b/node_modules/@github/combobox-nav/dist/index.js
5+
@@ -34,7 +34,7 @@ export default class Combobox {
6+
this.input.addEventListener('compositionend', this.compositionEventHandler);
7+
this.input.addEventListener('input', this.inputHandler);
8+
this.input.addEventListener('keydown', this.keyboardEventHandler);
9+
- this.list.addEventListener('click', commitWithElement);
10+
+ this.list.addEventListener('mousedown', commitWithElement);
11+
this.indicateDefaultOption();
12+
}
13+
stop() {
14+
@@ -44,7 +44,7 @@ export default class Combobox {
15+
this.input.removeEventListener('compositionend', this.compositionEventHandler);
16+
this.input.removeEventListener('input', this.inputHandler);
17+
this.input.removeEventListener('keydown', this.keyboardEventHandler);
18+
- this.list.removeEventListener('click', commitWithElement);
19+
+ this.list.removeEventListener('mousedown', commitWithElement);
20+
}
21+
indicateDefaultOption() {
22+
var _a;

Diff for: public/widget/GYJwhgtkA/2.8.0/planner-web.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: public/widget/GYJwhgtkA/2.8.0/planner-web.d.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import type { GeocoderFeature } from '@atb/page-modules/departures';
2+
3+
export declare function createWidget({ urlBase, language, }: WidgetOptions): PlannerWebOutput;
4+
5+
declare type Languages = 'nb' | 'nn' | 'en';
6+
7+
export declare type PlannerWebOutput = {
8+
output: string;
9+
init: () => void;
10+
urls: SettingConstants;
11+
};
12+
13+
export declare function reverse(urlBase: string, coords: GeolocationCoordinates): Promise<GeocoderFeature | undefined>;
14+
15+
declare type SettingConstants = {
16+
URL_BASE: string;
17+
URL_JS_UMD: string;
18+
URL_JS_ESM: string;
19+
URL_CSS: string;
20+
};
21+
22+
export declare type WidgetOptions = {
23+
urlBase: string;
24+
language?: Languages;
25+
};
26+
27+
export { }

0 commit comments

Comments
 (0)