Skip to content

Naming convention for proposed elements #184

Closed

Description

@una

RE: #180

I'd like to discuss about naming conventions for these elements. Take file as an example:

  • current HTML: <input type="file">
  • open-UI proposal: <file>

Another option would be <file-input> or <input-file> as a naming convention. These feel more clear to me and nod to the underlying web components (which we hope to become native). You can also replace "file" with anything and you still have a naming pattern, i.e.:

  • <input-color>
  • <input-date>
  • <input-dropdown>

etc.

Activity

  1. changed the title [-]Naming convention for new elements[/-] [+]Naming convention for proposed elements[/+] on Sep 30, 2020
  2. added
    discussion
    on Sep 30, 2020
  3. kenchris commented on Sep 30, 2020

    @kenchris

    People might have made custom elements with those names as they contain a hyphen, so that might cause issues

  4. gregwhitworth commented on Oct 6, 2020

    @gregwhitworth
    Member

    @kenchris that's a valid point but not entirely sure how that relates to Open UI specifically. If they make their way into the platform itself they may not have a hyphen as only platform based components can be implemented without a dash. I think as it relates to creating a component following Open UI leveraging the web component paradigm makes sense until a standardize HTML element is created.

    With regards to the options, I kind of want to get away from the input foo paradigm personally. That's why I initially recommended file as I think that's what should be proposed for the native element. That said, Open UI should probably not take a dependency on that until it is standardized in WHATWG.

    TLDR; I agree that we should use a web components naming convention unless a standardized element that matches the same semantic meaning can be used in its place. Which specific name for file and inputs in general I don't have a strong pref.

  5. bkardell commented on Oct 8, 2020

    @bkardell
    Collaborator

    I kind of want to get away from the input foo paradigm personally.

    I would say this is a largely uncontroversial position among implementers/plenty of standards people. The type model in which a thing totally changes its 'ness' is a regrettable choice that is full of problems we are still digging out of, and we'd rather use composition/decoration here. So, I agree.

  6. levithomason commented on Oct 8, 2020

    @levithomason
    Member

    The ideal eventual HTML element would be <file>, etc, where the name of the component is the name of the element. This is how all component libraries I've seen name and implement their components. If we need to prefix for now, I'd support <oui-*> as a prefix meaning "Open UI", however, I don't think this should impact what browsers might implement someday.

  7. mrmckeb commented on Oct 19, 2020

    @mrmckeb
    Collaborator

    If we're not talking about standardisation, and instead about using these specifications to create inputs today, we could also prefix with wicg- so that it's clear that the input is built to the spec we've proposed. I don't mind input-, but I'm not a fan of suffixes (I feel that most developers would prefer prefixes).

    Long term, I agree that I'd like to see <file /> in use. Of course, with something like <select /> there would need to be a way to switch between behaviours, or we'd need to always be 100% compatible with the previous implementations of these types of elements.

  8. chrisdholt commented on Oct 19, 2020

    @chrisdholt
    Collaborator

    I think there's a couple of considerations here to be made.

    As some of these may not end up in the platform (or it may take awhile), how do we refer to the control - what do we call it? As other libraries are creating this and looking to align on naming, anatomy, parts, do we have a common way to refer to this control?. For those seeking alignment with open-ui and for whatever elements are proposed here I'd assume that name is part of it.

    If this is going into the platform, I think we would need to go without prefixing. Thus I'd expect a proposed name of file. If we are speaking to an element which would live within this repo, then I think wicg-file or oui-file would be acceptable. For custom element names looking to align to Open UI, I'd suggest leaving the prefix open as most implementors will already be prefixing their controls for their library.

    Given the different contexts to consider around naming, perhaps something like the following:

    Control name: File
    Proposed platform name: <file/>
    Proposed element: <____-file>

  9. erikkroes commented on Oct 26, 2020

    @erikkroes
    Contributor

    I find <file> a bit confusing and <input-file> more clear. How would <file> relate to tags like <video>? One is for displaying, and the other is for input. A <blockquote> does not ask you to input a quote.
    I think I prefer <input-file> because being an input and asking something from the user is what sets it apart, even more than being about files.

  10. jouni commented on Oct 27, 2020

    @jouni

    I hear what @erikkroes is saying.

    But I wonder, would we name checkbox and radio button similarly if we started from scratch? Would they be <input-checkbox> and <input-radiobutton>, or <checkbox> and <radiobutton>? What about text inputs? I don’t think <text> would work, so would that be <input-text>? And how about <textarea> and <select>? I’m just wondering, not sure if this is helpful for anyone.

    Specifically about files: what use cases should it cover? Just file submission, as part of a form? Would “upload” be a closer match then? Or do we want it to cover more use cases? For example where the user can choose a file from their local file system, to be edited by a web app? In both cases the user is opening the file browser and choosing one (or multiple) files.

    Apologies if I’m taking the discussion even further away from the original topic.

  11. added
    agenda+
    on Dec 8, 2020
  12. una commented on Jan 7, 2021

    @una
    CollaboratorAuthor

    Resolved in 01/07/2021 Open UI telcon meeting:

    Use openui- naming for prototyping and web components, and the file name after the prefix alone for native implementation of the components.

    i.e. <openui-superselect> and <superselect>

  13. removed
    agenda+
    on Jan 7, 2021
  14. added
    Misc
    and removed
    discussion
    on Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Misc

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions