Skip to content

Press enter on button that has focus doesn't work #90

@tesicg

Description

@tesicg

I have AngularJS template (modal dialog) and there is a code as following:

<div class="col-sm-9 dlg-input-pr">
    <div>
        <label for="ClientsURL">URL for client</label>
        <input id="ClientsURL" ng-model="publishOptions.uniqueURL" type="text" class="uui-form-element" value="{{publishOptions.uniqueURL}}" select-on-click tabindex="1" />
    </div>
</div>
<div class="col-sm-3 dlg-btn screen">
    <ng-switch on="isPublishOptionsHidden">
        <button ng-switch-when="true"
                class="uui-button lime-green"
                clip-copy="getTextToCopy()"
                auto-focus>
            Copy
        </button>
        <button ng-switch-when="false"
                class="uui-button lime-green"
                clip-copy="getTextToCopy()">
            Copy
        </button>
    </ng-switch>
</div>

Here is function that gets the text to be copied:

$scope.getTextToCopy = function () {
    return $scope.publishOptions.uniqueURL;
};

The first goal is to put focus on button when dialog opens, which I did using auto-focus directive. The second goal is to add the possibility when focus is on button to press enter and copy text from input box (ClientsURL). It doesn't work that is doesn't copy text to clipboard. It works when I click button using mouse.

How to solve this issue?

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