Azure-Samples / active-directory-b2c-advanced-policies

Sample for use with Azure AD B2C with Custom Policies.
http://aka.ms/aadb2ccustom
MIT License
218 stars 143 forks source link

Support focus on the first attribute (HTML input element) - urn:com:microsoft:aad:b2c:elements:selfasserted:1.1.0 #30

Open rakragh opened 6 years ago

rakragh commented 6 years ago

Content definitions (TrustFrameworkPolicy element "ContentDefinition") with DataUri="urn:com:microsoft:aad:b2c:elements:selfasserted:1.1.0" do not set the focus on the first attribute (HTML input element for claim).

Only the content definiton with DataUri="urn:com:microsoft:aad:b2c:elements:unifiedssp:1.0.0" contains a useful focus setting.

Because own JavaScript is filtered out, this should be fixed rapidly. Otherwise we have to inform the users that they must press TAB or use mouse.

Please fix this problem asap. It is one line JavaScript/jQuery

$(document).ready(function() {
    $('form:first *:input[type!=hidden]:first').focus();
});

OR (much easier)

A line similar to the following (marked with "/ FIX HERE /") for all attributes:

Handlebars.registerHelper('buildTextInput', function (id, type, placeholder, value, pattern, patternDesc, title, required, readonly, index, options) {
        var input = '<input id="' + id + '" class="textInput" type="' + type + '" ';
        var ariaLabel = "";
        var passwordErrorMsgsStr = "";

    /* FIX HERE */ input += 'autofocus '; // New line inserted

        if (placeholder) {
            input += 'placeholder="' + placeholder + '" ';
        }

P. S.: Twice posted (other entry: https://github.com/Azure-Samples/active-directory-b2c-custom-policy-starterpack/issues/27) - please decide which repo is the right one.