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

docsearch css classes conflict with autocomplete.js #102

Closed
vvo opened this issue May 30, 2016 · 3 comments
Closed

docsearch css classes conflict with autocomplete.js #102

vvo opened this issue May 30, 2016 · 3 comments

Comments

@vvo
Copy link
Contributor

vvo commented May 30, 2016

We currently have all the autocomplete.js css classes added by default (aa-*), thus if you have both docsearch on a website and autocomplete.js you may have css conflicts when trying to style things.

It depends on how you write css to style docsearch but if you style it like we did for example in our headers or our websites: using aa-* css classes then other autocomplete.js menus will inherit from the same style.

To avoid this situations we could use the new cssClasses option of autocomplete.js: https://github.com/algolia/autocomplete.js#options.

This is what is done on Algolia Places for instance: https://github.com/algolia/places/blob/master/src/places.js#L67 we change the default prefix, thus we avoid any conflicting CSS class name if other autocomplete.js menus are present.

What do you think?

@pixelastic
Copy link
Contributor

Argh, good catch.

We should definitely add that for future version, but this will be a breaking change for all the DocSearch already live.

It is possible to pass options to autocomplete.js through docsearch.js, so for people that have the issue today, I would suggest changing the prefix here and the associated CSS rules. Maybe add a not about that in the README somewhere?

For the v2 we'll need to change the prefix to something else, like ds-, but for now I'm afraid we have to keep the aa-.

@maxiloc
Copy link
Contributor

maxiloc commented Jun 14, 2016

Do we have any example (website) of where this is an issue ?

@vvo
Copy link
Contributor Author

vvo commented Jun 14, 2016

Yes on the places website, where we have both docsearch and places. Both are using autocomplete.js. Current docsearch styling is done via using the standard aa-* css classes. At first marking the places input look like docsearch.

In places.js I solved it by using the prefix option to prefix every css class with "ap-": https://github.com/algolia/places/blob/f480c7886cf18f57202151565f5d911fea523feb/src/places.js#L29

It would be better on the long run for docsearch to have specific ds-* only css classes rather than using the standard aa- css classes. So that we can isolate the styling versus conflicting with any other already existing autocomplete menu.

@vvo vvo closed this as completed Jun 14, 2016
@vvo vvo reopened this Jun 14, 2016
maxiloc added a commit that referenced this issue Jun 14, 2016
maxiloc added a commit that referenced this issue Jun 14, 2016
maxiloc added a commit that referenced this issue Jun 14, 2016
Add a no result screen. Fixes #92
Change class prefix. Fixes #102
Add a transformData option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
- Add searchBox option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
- Add searchBox option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
- Add searchBox option
- Add a layout option
maxiloc added a commit that referenced this issue Jun 14, 2016
- Add a no result screen. Fixes #92
- Change class prefix. Fixes #102
- Add a transformData option
- Add searchBox option
- Add a layout option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants