We first tried this in Revert "DEV: Drop old IE11 intersection-observer references" by oblakeerickson · Pull Request #13017 · discourse/discourse · GitHub, but ran into white-screen issues with some users who had manually disabled IntersectionObserver in iOS. This removes the polyfill again but also ensures that the intersection observer is only invoked if available.
Due to recent changes, there is now only one place left where we use the IntersectionObserver, in the emoji picker of the composer. Older browsers with no IO support just won’t get the fancy highlighting of the current emoji group.
This PR also makes a few improvements to the emoji picker:
- invokes the observer after the elements are added to DOM (otherwise there is nothing to observe)
- when filtering, it disables the sidebar tabs (because the groups are no longer displayed once you filter)
- shows a max of 20 results by default (feels like better UX when searching with short strings)