Skip to content

Toggle width does not adjust to longer labels #33

@bertysentry

Description

@bertysentry

When using the on and off attributes to set labels with relatively long text (10 to 20 chars), the width of the toggle wrapper doesn't adjust properly.

Example:

<toggle ng-model="$ctrl.someValue" on="My Long Toggle" off="Is Not Well Adjusted"></toggle>

This is because the width of the toggleWrapper div is based on offsetWidth of the on and off labels, which doesn't include the part of the label that may be clipped and not visible, which is the case with labels in toggle.

Suggestion: Use the scrollWidth property instead

Also: add 24px to adjust for the padding...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions