diff --git a/docs/articles/cssspecification.md b/docs/articles/cssspecification.md index 6bd787e33..296a33c06 100644 --- a/docs/articles/cssspecification.md +++ b/docs/articles/cssspecification.md @@ -2186,6 +2186,12 @@ box-margin: 10dp 10dp; --- +### focusable + +Set / unset the widget as focusable to navigate with tab / tab + shift navigation + +--- + ### foreground Same as the [background](#background) but for the foreground of the node. diff --git a/include/eepp/ui/css/propertydefinition.hpp b/include/eepp/ui/css/propertydefinition.hpp index 72505b35f..86e5ce7a4 100644 --- a/include/eepp/ui/css/propertydefinition.hpp +++ b/include/eepp/ui/css/propertydefinition.hpp @@ -210,6 +210,7 @@ enum class PropertyId : Uint32 { LineSpacing = String::hash( "line-spacing" ), GravityOwner = String::hash( "gravity-owner" ), Href = String::hash( "href" ), + Focusable = String::hash( "focusable" ), }; enum class PropertyType : Uint32 { diff --git a/src/eepp/ui/css/stylesheetspecification.cpp b/src/eepp/ui/css/stylesheetspecification.cpp index c36634804..5dc798c4a 100644 --- a/src/eepp/ui/css/stylesheetspecification.cpp +++ b/src/eepp/ui/css/stylesheetspecification.cpp @@ -391,6 +391,7 @@ void StyleSheetSpecification::registerDefaultProperties() { registerProperty( "select-on-click", "false" ).setType( PropertyType::Bool ); registerProperty( "gravity-owner", "false" ).setType( PropertyType::Bool ); registerProperty( "href", "" ).setType( PropertyType::String ); + registerProperty( "focusable", "true" ).setType( PropertyType::Bool ); // Shorthands registerShorthand( "margin", { "margin-top", "margin-right", "margin-bottom", "margin-left" }, diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 965bceac3..70be18076 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -1738,9 +1738,18 @@ bool UIWidget::applyProperty( const StyleSheetProperty& attribute ) { break; case PropertyId::BorderSmooth: setBorderEnabled( true )->setSmooth( attribute.asBool() ); + break; case PropertyId::BackgroundSmooth: setBackgroundFillEnabled( true )->getBackgroundDrawable().setSmooth( attribute.asBool() ); + break; + case PropertyId::Focusable: + if ( attribute.asBool() ) { + setFlags( UI_TAB_FOCUSABLE ); + } else { + unsetFlags( UI_TAB_FOCUSABLE ); + } + break; default: attributeSet = false; break; diff --git a/src/tools/ecode/uiwelcomescreen.cpp b/src/tools/ecode/uiwelcomescreen.cpp index cc40548b6..3a67e6ef8 100644 --- a/src/tools/ecode/uiwelcomescreen.cpp +++ b/src/tools/ecode/uiwelcomescreen.cpp @@ -9,6 +9,7 @@ const char* LAYOUT = R"xml(