MCPcopy
hub / github.com/winjs/winjs / ILightDismissable

Interface ILightDismissable

src/js/WinJS/_LightDismissService.ts:212–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210
211// Keep in sync with ILightDismissableElementArgs.
212export interface ILightDismissable {
213 // This dismissable should be rendered at a z-index of *zIndex*.
214 setZIndex(zIndex: string): void;
215 // How many z-indices are required by this dismissable?
216 getZIndexCount(): number;
217 // Does the dismissable contain *element*?
218 containsElement(element: HTMLElement): boolean;
219
220 // Hooks
221
222 // The dismissable should take focus if focus isn't already inside of it.
223 // This fires when:
224 // - the dismissable becomes the active/topmost dismissable
225 // - the topmost dismissable loses focus but doesn't dismiss
226 // *useSetActive* is a hint to onTakeFocus as to whether or not it should draw a
227 // keyboard focus visual when taking focus. If the last input type was keyboard,
228 // use focus() so a keyboard focus visual is drawn. Otherwise, use setActive() so
229 // no focus visual is drawn.
230 onTakeFocus(useSetActive: boolean): void;
231 // Focus has moved into or within this dismissable (similar to a focusin handler except
232 // you don't have to explicitly register for it).
233 onFocus(element: HTMLElement): void;
234 // This dismissable is now shown (i.e. has been added to the light dismiss service).
235 onShow(service: ILightDismissService): void;
236 // This dismissable is now hidden (i.e. has been removed from the light dismiss service).
237 onHide(): void;
238
239 // Called when a keyDown, keyUp, or keyPress event happens on this dismissable or on a
240 // dismissable that is higher in the light dismiss stack. Gives light dismissables the
241 // opportunity to intercept keyboard events that occur on light dismissables that are
242 // higher in the stack. This is used by modals to ensure that, when a modal is somewhere
243 // in the light dismiss stack, keyboard events don't escape the light dismiss stack
244 // and fire on the body element.
245 onKeyInStack(info: IKeyboardInfo): void;
246
247 // Dismissal
248
249 // A light dismiss was triggered. Return whether or not this dismissable should be dismissed. Built-in
250 // implementations of this method are specified in LightDismissalPolicies.
251 onShouldLightDismiss(info: ILightDismissInfo): boolean;
252 // Should implement what it means for this dismissable to be dismissed (e.g. call control.hide()). Just because
253 // this method is called doesn't mean that the service thinks this dismissable has been dismissed. Consequently,
254 // you can decide to do nothing in this method if you want the dismissable to remain shown. However, this decision
255 // should generally be made in onShouldLightDismiss if possible. The dismissable is responsible for calling
256 // _LightDismissService.hidden at some point.
257 onLightDismiss(info: ILightDismissInfo): void;
258}
259
260//
261// ILightDismissable implementations

Callers

nothing calls this directly

Implementers 4

AbstractDismissableElementsrc/js/WinJS/_LightDismissService.ts
LightDismissableBodysrc/js/WinJS/_LightDismissService.ts
LightDismissableElementsrc/js/WinJS/_LightDismissService.ts
ModalElementsrc/js/WinJS/_LightDismissService.ts

Calls

no outgoing calls

Tested by

no test coverage detected