-
Notifications
You must be signed in to change notification settings - Fork 5
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
close autocomplete on click in parent window #1034
Conversation
@@ -145,6 +145,10 @@ | |||
HitchhikerJS.RuntimeConfigReceiver.handle(message.runtimeConfig); | |||
} else if (window.isOverlay) { | |||
window.Overlay.onMessage(message); | |||
} else if (message.eventType && message.eventType === 'click') { | |||
ANSWERS.components._activeComponents |
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.
@oshi97 or @tmeyer2115 , I'm wondering how you all feel about using ANSWERS.components._activeComponents
since it's a private property. Alternatively, we could add a public function to the SDK which would allow us to get all of autocomplete components
@@ -145,6 +145,10 @@ | |||
HitchhikerJS.RuntimeConfigReceiver.handle(message.runtimeConfig); | |||
} else if (window.isOverlay) { | |||
window.Overlay.onMessage(message); | |||
} else if (message.eventType && message.eventType === 'click') { | |||
ANSWERS.components._activeComponents |
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.
We should probably make a method under ANSWERS.components
called getByName
. That way, we don't leak private, implementation details here. But, that's beyond this scope of this PR. I'll make a separate item to address.
### Features - Multi-lang versions of the `document-standard` result card and the `documentsearch-standard` direct answer card have been added. (#1041, #1039) - We automatically bump the `sdkVersion` in the `global_config` on upgrade. (#1031) ### Changes - RTF styling was added to the `event-standard`, `faq-accordion`, and `location-standard` cards. (#1037) - The default `universalSectionTemplate` for a `vertical-grid` page was updated to `grid-three-columns`. (#1038) ### Bugfixes - When clicking outside the iFrame'd experience, the query suggestions dropdown now closes. (#1034) - There was a bug with the custom `card` command. If the new card's name contained the name of the forked card, the former would not be added properly. This is now fixed. (#1036) - Previously, if there was a Map on the Universal page, a user could get stuck on the Map while scrolling down the page. This has been fixed. (#1030, #1042)
close autocomplete on click in parent window by sending message from parent window to iframe using iFrameResizer library
in iframe-common.js, run by parent page, add an event listener to the document for click event. When trigger, check if the event is trusted (invoke by user, not external script) and send a message to iframe. In html.hbs, run by iframe, modify onMessage function in iframeResizer to check for message that contains event type 'click'. If so, get all active autocomplete components and invoke their close function.
J=SLAP-1182
TEST=manual
host a site in SGS with a page that uses iframe.js from localhost port (with the pr changes) for cross-origin test. Also modify page to have multiple search bar. See that autocomplete closes when click outside of iframe.