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

[Feature] Add more id and data attributes #4779

Open
echo6ix opened this issue Apr 21, 2024 · 2 comments
Open

[Feature] Add more id and data attributes #4779

echo6ix opened this issue Apr 21, 2024 · 2 comments

Comments

@echo6ix
Copy link
Contributor

echo6ix commented Apr 21, 2024

Synopsis

Now that the project has fully embraced third-party customization with plugins, please make the markup more accessible to styling. We can start by simply adding id and data attributes wherever relevant.

id attribute

Lets use the id attribute to define unique structural sections on each page. This would make styling more accessible (requiring less convoluted selector declarations) and help to determine particular pages.

I propose something like a #pageName-section format for ID attribute names.

/* Declares the "main" container of scene grid view page
  i.e. <div class="main container ..." id="scenes_gridview-main"> */
#scenes_gridview-main

/* Other sample declarations... */
#scenes_detailview-main
#scenes_detailview-sidebar
#scenes_detailview-video
#images_detailview-main
#images_detailview-sidebar
#images_detailview-video

data-* attribute

Lets add more data-* attributes where relevant. Some of these might be redundant or overly simple, but I'm just spitballing. I welcome people to provide feedback for more pragmatic examples

  • every rating containers -> data-value="$rating"
  • watch container -> data-value="$count"
  • o-count container -> data-value="$count"
  • organized container -> data-value=boolean
  • where image placeholders exist for performer image, studio image, etc -> data-value=boolean
    etc
@xx790
Copy link

xx790 commented Apr 21, 2024

  • any tag representation -> data-tag-id="$id"

I would also love to have data-parent-tag-ids, but that would require more work to expose those.

Purpose - to simulate tag namespaces with differently styled tags.

@xx790
Copy link

xx790 commented Apr 21, 2024

I'd argue that "value" in every data-value= should be replaced with something descriptive for each case.

If I were the one adding data attributes, I'd try to add them to the highest-level element that contains the entity whose properties are in the attributes (or the one that best describes the entity, in case it has some boilerplate wrappers).
That would mean, for example, that watch counter, o-counter, etc. all will be added to the same element.

I don't know what the most common approach is - adding data attributes to most specific element or highest-level element.
I guess it might depend on what selectors are most expected.
(Before introduction of :has() selectors, having attributes higher in the tree was obviously beneficial.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants