From 3cfcaf3322eca302dd018a27da8d8faf06f4559b Mon Sep 17 00:00:00 2001 From: xidedix Date: Tue, 3 Jun 2025 15:33:45 +0200 Subject: [PATCH 1/6] fix(button): cButton directive loosing tabindex attribute, refactor; close #228 - thanks @bernik1980 --- .../src/lib/button/button.directive.ts | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/projects/coreui-angular/src/lib/button/button.directive.ts b/projects/coreui-angular/src/lib/button/button.directive.ts index 30bae81c..0e1fbddf 100644 --- a/projects/coreui-angular/src/lib/button/button.directive.ts +++ b/projects/coreui-angular/src/lib/button/button.directive.ts @@ -1,6 +1,14 @@ -import { booleanAttribute, computed, Directive, input, InputSignal, InputSignalWithTransform } from '@angular/core'; +import { + booleanAttribute, + computed, + Directive, + input, + InputSignal, + InputSignalWithTransform, + numberAttribute +} from '@angular/core'; -import { ButtonType, Colors, Shapes } from '../coreui.types'; +import { BooleanInput, ButtonType, Colors, Shapes } from '../coreui.types'; @Directive({ selector: '[cButton]', @@ -16,6 +24,9 @@ import { ButtonType, Colors, Shapes } from '../coreui.types'; } }) export class ButtonDirective { + static ngAcceptInputType_active: BooleanInput; + static ngAcceptInputType_disabled: BooleanInput; + /** * Toggle the active state for the component. [docs] * @type InputSignalWithTransform @@ -46,6 +57,11 @@ export class ButtonDirective { */ readonly size: InputSignal<'' | 'sm' | 'lg'> = input<'' | 'sm' | 'lg'>(''); + /** + * The tabindex attribute specifies the tab order of an element (when the "tab" button is used for navigating). + */ + readonly tabindex = input(undefined, { transform: numberAttribute }); + /** * Specifies the type of button. Always specify the type attribute for the `