Exemple #1
0
 internal static DisplayableElementLocalData GetErrorFocusableElementLocalData(
     ElementContext context, string elementName, ErrorSourceSet errorSources, IReadOnlyCollection <ElementAttribute> attributes) =>
 new DisplayableElementLocalData(
     elementName,
     new FocusabilityCondition(false, errorFocusabilitySources: errorSources),
     isFocused => {
     if (isFocused)
     {
         attributes = (attributes ?? Enumerable.Empty <ElementAttribute>()).Append(new ElementAttribute("tabindex", "-1")).Materialize();
     }
     return(new DisplayableElementFocusDependentData(
                attributes: attributes,
                includeIdAttribute: isFocused,
                jsInitStatements: isFocused
                                                                   ? "document.getElementById( '{0}' ).focus(); document.getElementById( '{0}' ).scrollIntoView( {{ behavior: 'smooth', block: 'start' }} );"
                .FormatWith(context.Id)
                                                                   : ""));
 });
Exemple #2
0
 private DisplayableElementLocalData getErrorFocusableElementLocalData(
     ElementContext context, string elementName, IReadOnlyCollection <ElementAttribute> attributes) =>
 ListErrorDisplayStyle.GetErrorFocusableElementLocalData(context, elementName, ErrorSourceSet, attributes);