InvisibleMessage
The InvisibleMessage provides a way to programmaticaly expose dynamic content changes in a way that can be announced by screen readers.
Z2UI5_CL_SMPC_APP_141
Controls
sap.ui.core
UI5 1.78
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_141- Source file
z2ui5_cl_smpc_app_141.clas.abap↗- Library
- sap.ui.core
- UI5 entity
sap.ui.core.InvisibleMessage- Demo kit sample
sap.ui.core.sample.InvisibleMessage- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.78
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: invisiblemessage, invisible, message, sap.ui.core, a11y, hbox, button, flexitemdata, text
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_141.clas.abap — 131 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords invisiblemessage invisible message sap.ui.core a11y hbox button flexitemdata text
" @summary The InvisibleMessage provides a way to programmaticaly expose dynamic content changes in a way that can be announced by screen readers.
CLASS z2ui5_cl_smpc_app_141 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA statustext TYPE string.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_141 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_init( ).
statustext = `There is no message sent to the invisible message service. Please, press a button.`.
view_display( ).
ELSEIF client->check_on_navigated( ).
view_display( ).
ELSEIF client->check_on_event( ).
on_event( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `xmlns:core` v = `sap.ui.core`
)->a( n = `height` v = `100%`
)->ele( `Page`
)->a( n = `showHeader` v = `false`
)->a( n = `class` v = `sapUiContentPadding`
)->ele( `content`
)->ele( `HBox`
)->ele( `Button`
)->a( n = `text` v = `Infromation`
)->a( n = `press` v = client->_event( val = `PRESS`
t_arg = VALUE #( ( `$event.oSource.getType()` )
( `$event.oSource.getText()` ) ) )
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `type` v = `Accept`
)->a( n = `text` v = `Success`
)->a( n = `press` v = client->_event( val = `PRESS`
t_arg = VALUE #( ( `$event.oSource.getType()` )
( `$event.oSource.getText()` ) ) )
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->ele( `Button`
)->a( n = `type` v = `Reject`
)->a( n = `text` v = `Error`
)->a( n = `press` v = client->_event( val = `PRESS`
t_arg = VALUE #( ( `$event.oSource.getType()` )
( `$event.oSource.getText()` ) ) )
)->ele( `layoutData`
)->tag( `FlexItemData`
)->a( n = `growFactor` v = `1`
)->end(
)->end(
)->tag( `Button`
)->a( n = `type` v = `Emphasized`
)->a( n = `text` v = `Emphasized`
)->a( n = `press` v = client->_event( val = `PRESS`
t_arg = VALUE #( ( `$event.oSource.getType()` )
( `$event.oSource.getText()` ) ) )
)->end(
)->ele( `HBox`
)->tag( `Text`
)->a( n = `id` v = `statustext`
)->a( n = `text` v = client->_bind( statustext ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `PRESS`.
" original onPress: announces the pressed button's type+text to the
" InvisibleMessage a11y service and echoes it into the status Text. The
" pressed button's identity rides along as event args, the message is
" composed here exactly as the original concatenates it, and the
" announcement itself goes out through the INVISIBLE_MESSAGE global
" target - the singleton has no control id, so control_global is the
" only route to it (same wire as apps 289 and 435)
DATA(message) = |Button with type { client->get_event_arg( ) } | &&
|and text { client->get_event_arg( 2 ) } is pressed|.
client->follow_up_action( val = client->cs_event-control_global
t_arg = VALUE #( ( `INVISIBLE_MESSAGE` )
( `announce` )
( message )
( `Assertive` ) ) ).
statustext = |A new message with text: "{ message }" | &&
|was sent to the invisible messaging service.|.
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.ui.core
- Icon — Built with an embedded font, icons scale well, and can be altered with CSS. They can also…
- InvisibleText — Many controls provide the associations ariaLabelledBy and ariaDescribedBy for accessibili…
- Integer Format — Formats and parses only the integer digits. The decimal digits are ignored.
- Control Busy Indicator — A control's busy indicator can be used to block parts of the screen until an operation ha…
- Basic Theme Parameters — Sample provides a link to the Theme Parameter Toolbox. There you can easily search, previ…
- Currency Format — Formats the number by using the parameters defined for the given currency code. Either cu…
- Hyphenation API — This sample demonstrates usage of the Hyphenation API
- Busy Indicator — A busy indicator can be used to block the entire screen until an operation has finished.
- Float Format — Formats and parses both integer and decimal digits.
- FileSize Type — This sample explains the formatting options of the FileSize type.
- Date Type - Source As String — This sample explains the formatting options of the Date type with the date being availabl…
- Time Type — This sample explains the formatting options of the Time type.
On this page