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

Prefix CSS Classes for inspector #5422

Open
cmahnke opened this issue Dec 26, 2023 · 14 comments
Open

Prefix CSS Classes for inspector #5422

cmahnke opened this issue Dec 26, 2023 · 14 comments

Comments

@cmahnke
Copy link

cmahnke commented Dec 26, 2023

Description:

  • A-Frame Version: 1.5.0
  • Platform / Device: Chrome / Firefox, certainlny others as well

Currently The A-Frame Inspector uses quite generic Class names like static and content and certainly others as well, sine these are likely also used by page authors, please consider prefixing them.

@dmarcos
Copy link
Member

dmarcos commented Dec 26, 2023

CC @vincentfretin

@vincentfretin
Copy link
Contributor

The aframe-inspector is using stylus for the style, style is in https://github.com/aframevr/aframe-inspector/tree/master/src/style
Most of the css is using simple css rules with just a class name. Some with specificity like #scenegraph .component that will prevent bleeding to your page if you have some elements with class="component" for example.
What we saw is also the contrary, additional css in your project may impact the inspector, like this naf issue with class button and I also did some fixes related to tailwind or bootstrap reset styles in the page impacting the inspector.

Adding a prefix to all used class is one possible fix for both issues, this requires changes in the react code to replace the className attribute where the class is used.
Here is an exhaustive list of the class names used:

addComponent
assets
button
close
collapse-button
collapsespace
collapsible-content
collapsible-header
color
color_value
color-widget
commonComponents
componentHeader
componentHeaderActions
components
componentTitle
detail
entityActions
entityChildPadding
entityCloseTag
entityIcons
entityName
entityPrint
entityTagName
gallery
gltfIcon
help-key
help-key-def
help-key-unit
help-list
help-lists
hidden
hide
imageUrl
left
local-transform
map_value
mixinOptions
mixinValue
modal
modal-body
modal-content
modal-header
new_asset_options
newimage
number
option
outliner
preview
propertyRow
right
scenegraph
scenegraph-toolbar
search
select-widget
static
string
text
texture
title
toggle-edit
toggle-sidebar
toolbarActions
toolbarButtons
vec2
vec3
vec4

Potentially any of the above class may be an issue. Going through the aframe-inspector code base and renaming all that can be a bit of work.
Another solution would be using css modules instead of stylus, that way the class names will be generated and be unique.

Just curious, what class had you issue with?

@dmarcos
Copy link
Member

dmarcos commented Dec 27, 2023

Thanks for the break down

@cmahnke
Copy link
Author

cmahnke commented Dec 27, 2023

@vincentfretin: Thanks, my "frame" uses, or better: used until now (global) static, content and a few more from the above, where content had the most visible (making the inspector nearly unusable) impact.

I was able to change my theme, but I suspect that not everyone can do this, especially when using a CMS or SSG...

@dmarcos
Copy link
Member

dmarcos commented Dec 27, 2023

Maybe worth apply inspector classes to just the children of a parent with the class .aframe-inspector so they don't leak outside? @vincentfretin knows that code better than me so might not be appropriate.

@cmahnke
Copy link
Author

cmahnke commented Dec 27, 2023

@dmarcos: Issues also arise when the surrouding website (or CMS theme or whatever) provides a global .content stylesheet...

There's also the option of running A-Frame inside an iframe to prevent collisions.

@dmarcos
Copy link
Member

dmarcos commented Jan 7, 2024

What should we do here?

@cmahnke
Copy link
Author

cmahnke commented Jan 8, 2024

@dmarcos: From what I've read about the possible options, which are:

  • Prefixing (Requires changes in React code as well)
  • Using React CSS Modules (provided for example by styled-components

I opt for using a React based CSS module approach, since this will take care of the naming.

@vincentfretin
Copy link
Contributor

Yes, like @cmahnke said. For CSS Modules, I was talking about just importing css file and using webpack css-loader https://webpack.js.org/loaders/css-loader/ so nothing to do with React really or styled-components that is also a different thing.

@cmahnke
Copy link
Author

cmahnke commented Jan 8, 2024

Thanks for the clarification @vincentfretin
I wasn't aware of this distinction / possibility. Then as you propose.

@dmarcos
Copy link
Member

dmarcos commented Jan 8, 2024

Thanks! So nothing to do on the A-Frame side? Can we close?

@cmahnke
Copy link
Author

cmahnke commented Jan 8, 2024

@dmarcos: Well, it was my understanding that this is a change which is required on the inspector side...

@vincentfretin
Copy link
Contributor

It's a change in aframe-inspector, probably a day or two of work to changes the style code.
You can transfer the issue to the aframe-inspector repo to keep it there if you want.

@vincentfretin
Copy link
Contributor

I'm working on changing the way we use fontawesome icons first aframevr/aframe-inspector#706 before starting any migration to css modules.

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