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

Add label-checkbox relation in CreateLink form #1275

Closed
Dahkon opened this issue Jan 11, 2017 · 1 comment
Closed

Add label-checkbox relation in CreateLink form #1275

Dahkon opened this issue Jan 11, 2017 · 1 comment

Comments

@Dahkon
Copy link

Dahkon commented Jan 11, 2017

Description

When adding the targetCheckbox:true option for anchor links, label is missing the FOR attribute, checkbox is missing also the ID attribute to enable clicking on the label.

These attributes allow frameworks to replace the checkbox with a good looking one.

Here is my proposal :

                template.push(
                    '<div class="medium-editor-toolbar-form-row">',
                    '<input id="medium-editor-toolbar-anchor-target-field" type="checkbox" class="medium-editor-toolbar-anchor-target">',
                    '<label for="medium-editor-toolbar-anchor-target-field">',
                    this.targetCheckboxText,
                    '</label>',
                    '</div>'
                );

Thanks,

Versions

  • medium-editor: 5.22.1
  • browser: All
  • OS: All
@nmielnik
Copy link
Member

nmielnik commented Feb 9, 2017

For the id of the checkbox, we'd want to make sure we generate something unique. The editor has its own id attribute it defines when the editor is instantiated which ensures that each editor has an id that is unique even if multiple editors are created on the same page, so we could just use that. There's a built in getEditorId() helper method exposed to all extensions documentation.

We're actually already using this getEditorId() helper in the anchor extension when we specify an id for the anchor extension <div> that holds the textbox, checkboxes, buttons, etc. for entering the href for links. You can see how we use that here. We should just follow the same pattern for creating and id for the checkbox.

I think this makes sense and would be a nice and easy bug for anyone to make a simple contribution to medium-editor!

jamenamcinteer added a commit to jamenamcinteer/medium-editor that referenced this issue Jun 22, 2017
Added id to anchor target checkbox using this.getEditorId() for
uniqueness, and then added the for attribute to the label
jamenamcinteer added a commit to jamenamcinteer/medium-editor that referenced this issue Jun 22, 2017
Add label-checkbox relation in CreateLink form yabwe#1275
j0k3r added a commit that referenced this issue Jun 26, 2017
Add label-checkbox relation in CreateLink form #1275
@j0k3r j0k3r closed this as completed Jun 26, 2017
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

3 participants